LibCore: Ensure we don't replace an already-installed event loop manager

Once an event loop manager is installed, we want to be sure we only use
that manager in the current process going forward. Mixing event loop
implementations can only cause problems.

More to the point, this ensures that we have installed the AppKit or Qt
event loop managers before the first time EventLoopManager::the() is
invoked. Now that we defer this installation until we know whether we
are running headlessly, we want to be extra sure that we have done so
before any services using the event loop have started.
This commit is contained in:
Timothy Flynn 2025-06-13 10:34:07 -04:00 committed by Jelle Raaijmakers
parent 64d79d4c3f
commit 911ea2b379
Notes: github-actions[bot] 2025-06-13 15:32:34 +00:00

View file

@ -23,7 +23,7 @@ EventLoopImplementation::EventLoopImplementation()
EventLoopImplementation::~EventLoopImplementation() = default;
static EventLoopManager* s_event_loop_manager;
static EventLoopManager* s_event_loop_manager = nullptr;
EventLoopManager& EventLoopManager::the()
{
if (!s_event_loop_manager)
@ -33,6 +33,7 @@ EventLoopManager& EventLoopManager::the()
void EventLoopManager::install(Core::EventLoopManager& manager)
{
VERIFY(!s_event_loop_manager);
s_event_loop_manager = &manager;
}