This invariant is enforced by the fact that `NonnullGCPtr` can only be
constructed from references.
This commit fixes an instance where we compared a pointer to null after
we have already dereferenced it.
The compiler-generated copy constructor and copy assignment operator
already do the right thing (which is to simply copy the underlying
pointer).
The [Itanium C++ ABI][1] treats any class with non-trivial copy/move
constructors and destructors as non-trivial for the purposes of calls --
even if they are functionally identical to the compiler-generated ones.
If a class is non-trivial, it cannot be passed or returned in registers,
only via an invisible reference, which is worse for codegen. This commit
makes `{Nonnull,}GCPtr` trivial.
As the compiler can be sure that capturing a `GCPtr` by value has no
side effects, a few `-Wunused-lambda-capture` warnings had to be
addressed in LibWeb.
GCC seems to have a bug that prevents `ExceptionOr<Variant<GCPtr<T>>>`
from being implicitly constructed from `GCPtr<T>` after this change. A
non-invasive workaround is to explicitly construct the inner Variant
type.
[1]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#non-trivial
This will help a lot with developing chromes for different UI frameworks
where we can see which helper classes and processes are really using Qt
vs just using it to get at helper data.
As a bonus, remove Qt dependency from WebDriver.
This method will be used by the package manager code to render an actual
Port's name to raw text as it is stored as relative URL currently in the
AvailablePorts.md file.
The /usr/Ports/packages.db will be used later for tracking available
ports by the upcoming package manager, which will use it to do search
queries, providing metadata on available ports, etc.
Ports that are installed will be registered from now on in the file of
/usr/Ports/installed.db, so that file will be used later on to allow
further management of what is actually installed on the system.
Previously, case-change operations did not produce visible results.
As of now, setting `m_chars_touched_in_the_middle` to a non-zero value
results in refreshing the whole line. So case-change operations now set
that variable (causing a line refresh) in order to produce visible
results as expected.
This method can be used to force the current process to sleep, waiting
for a debugger to attach. On attach, the debugger breaks at the callsite
directly.
This is tested on Linux and macOS, in Clion and also terminal gdb and
lldb.
The user can now save, load, and view calendars. A calendar is made up
of an array of events which are saved in a JSON file. In the future we
should implement the iCalendar standard instead of using a custom
format.
The features provided by these classes should be used eventually, but so
far we've been maintaining these classes for over 2 years without any
actual use. We can restore them when it comes time to actually use them.
In distributions with newer versions of OpenSSL, when you run
Meta/serenity.sh rebuild-toolchain you'll get curl: (35)
error:0A000152:SSL routines::unsafe legacy renegotiation
disabled. This is because OpenSSL was compiled with legacy
renegotiation disabled by default. I've added instructions
to Documentation/BuildInstructions.md to solve this issue.
This will ensure that we don't leak any memory while playing back
audio.
There is an expectation value in the test that is only set to true when
PulseAudio is present for the moment. When any new implementation is
added for other libraries/platforms, we should hopefully get a CI
failure due to unexpected success in creating the `PlaybackStream`.
To ensure that we clean up our PulseAudio connection whenever audio
output is not needed, add `PulseAudioContext::weak_instance()` to allow
us to check whether an instance exists without creating one.
If we don't clear the callbacks, they may be called after our functions
are deleted.
Disconnecting the stream also doesn't appear to be done automatically
when calling `pa_stream_unref()` for the last time, so let's do that.
We don't want to pull the stream out from under our PulseAudio main
loop, so call these with the lock to ensure that nothing is touching
them.
The `pa_threaded_mainloop_stop()` call does not require lock as it sets
a flag to tell the main loop to exit.
The mutex used to protect from multiple threads creating PulseAudio
contexts simultaneously could remain locked when an application exited.
The static variables' destructors could be called on the main thread
while another thread is running `PulseAudioContext::instance()` and
synchronously connecting to a PulseAudio daemon. This would cause an
assertion in Mutex that it is unlocked upon its destructor being
called.
By creating a static `ScopeGuard` that locks and immediately unlocks
the mutex, we can ensure that the main thread waits for the connection
to succeed or fail. In most cases, this will not take long, but if the
connection is timing out, it could take a matter of seconds.
Now that `Thread` keeps itself alive when it is running detached, we do
not need to hold onto it in the PulseAudio playback stream's internal
state object. This was a hack that did not work correctly because the
`Thread` object and its action `Function` would be deleted before the
action had exited and cause a crash.
Previously, a `Thread` could be deleted while its action was running,
even if it was running detached.
By changing it to be atomically reference counted, and incrementing the
count when starting the action, we can keep the Thread and its running
action `Function` alive until it exits. Thus, detached `Thread` objects
can be deleted by the thread creating them and allowed to die
naturally.
Inheritance from `EventReceiver` on the `Thread` class was only used in
the `BackgroundAction` class, where the children vector was keeping the
action alive until the work was completed. However, this can be
accomplished by instead capturing a `NonnullRefPtr` of `this`. The work
function can then avoid having to remove the `BackgroundAction` from
its parent `Thread` when the work completes.
With the CMake build, the ladybird binary ends up in
$build/bin/ladybird.app/Contents/MacOS. Which is a bit unfortunate for
a few reasons, but the main one is that --enable-lagom-networking
doesn't work with ./Meta/serenity.sh run lagom ladybird.
Let's copy the file to the expected location. There's very likely better
solutions we can use in the future.
A typo in the changes to our userland timekeeping classes caused us to
make a syscall every time we want to check whether a timer is ready to
fire in `EventLoopManagerUnix::wait_for_events()`. Instead, only use
coarse time, and get it immediately before it is used in both cases.
This reduces CPU usage by an (eyeballed) 20-30% while playing back
video with VideoPlayer.
Before painting the borders, build a grid snapped to device pixels and
use it to construct the rectangles for the cell edges. Also adjust
their starting coordinate and size such that they join correctly
without overhangs. This approach works at all zoom levels.
Previously, typing e.g. `/home/anon` in the filename field of the
FilePicker resulted in an error for applications expecting an existing
file to open. Intuitively I expected the file picker to navigate to the
directory I typed there, similar to what we have with the location text
box at the top, so I changed it to do exactly that :^)