Skip to content

Fix onClientBrowserCreated never firing after lazy loading changes#4813

Merged
Lpsd merged 1 commit intomultitheftauto:masterfrom
Lpsd:fix/cef-browser-created-event
Apr 15, 2026
Merged

Fix onClientBrowserCreated never firing after lazy loading changes#4813
Lpsd merged 1 commit intomultitheftauto:masterfrom
Lpsd:fix/cef-browser-created-event

Conversation

@Lpsd
Copy link
Copy Markdown
Member

@Lpsd Lpsd commented Apr 15, 2026

Lazy loading (ab0bcbf) removed Initialise() to defer CefBrowserHost::CreateBrowser() until the first LoadURL() call. However, scripts universally wait for onClientBrowserCreated before calling loadBrowserURL - creating a deadlock: the event needs CreateBrowser, but CreateBrowser needs LoadURL, which scripts only call after the event.

Fix: restore eager browser creation in Initialise() by calling EnsureBrowserCreated(). The idempotency guard and pending URL mechanism from the lazy loading fixes (eefc173) are preserved for the race condition where LoadURL is called before OnAfterCreated fires.

Lazy loading (ab0bcbf) gutted Initialise() to defer CefBrowserHost::CreateBrowser()
until the first LoadURL() call. However, scripts universally wait for
onClientBrowserCreated before calling loadBrowserURL - creating a deadlock:
the event needs CreateBrowser, but CreateBrowser needs LoadURL, which scripts
only call after the event.

Fix: restore eager browser creation in Initialise() by calling
EnsureBrowserCreated(). The idempotency guard and pending URL mechanism
from the lazy loading fixes (eefc173) are preserved for the race
condition where LoadURL is called before OnAfterCreated fires.
@Lpsd Lpsd merged commit c953cbb into multitheftauto:master Apr 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant