mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 17:15:26 +00:00
Previously, we stored a RefPtr to the HackStudioWidget in the global scope. This led to a destruction-order related use-after-free bug, where the global HackStudioWidget instance destructed after the static-local GUI::Clipboard instance. When HackStudioWidget destructs it attempts to use the global Clipboard instance, which had already been freed. This caused the Hack Studio process to spin endlessly on exit because it attempted to access the HashTable of the freed Clipboard object. We now store a global WeakPtr to the HackStudioWidget instead, and limit the lifetime of the object to the main function scope.