diff --git a/Userland/Libraries/LibGUI/Clipboard.cpp b/Userland/Libraries/LibGUI/Clipboard.cpp index 7038c9cfaa..9e1cb1a287 100644 --- a/Userland/Libraries/LibGUI/Clipboard.cpp +++ b/Userland/Libraries/LibGUI/Clipboard.cpp @@ -44,6 +44,12 @@ void Clipboard::initialize(Badge) Clipboard& Clipboard::the() { + static bool s_destructed = false; + static ScopeGuard destructed_guard([] { + s_destructed = true; + }); + VERIFY(!s_destructed); // Catch use-after-free + static Clipboard s_the; return s_the; }