mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-25 02:12:39 +00:00
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:
parent
64d79d4c3f
commit
911ea2b379
Notes:
github-actions[bot]
2025-06-13 15:32:34 +00:00
Author: https://github.com/trflynn89
Commit: 911ea2b379
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5078
Reviewed-by: https://github.com/gmta ✅
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue