Skip to content

Initialize dock later to bypass startup crash - #554

Merged
RytoEX merged 1 commit into
obsproject:masterfrom
WizardCM:fix-startup-integration-crash
Oct 27, 2026
Merged

RytoEX merged 1 commit into
obsproject:masterfrom
WizardCM:fix-startup-integration-crash

Conversation

@WizardCM

Copy link
Copy Markdown
Member

Description

This one's fun.

This delays CEF & browser dock initalisation on startup to avoid a potential crash on startup in specific configurations.

Luckily this is an edge case most users won't run into.

Unfortunately I didn't catch this sooner, as I usually don't close my chat dock. Originally I thought this was tied to the "Closing Dockable Window" dialog (when closing for the first time), but seems that was a red herring.

Motivation and Context

Reproduction Steps:

  1. Be on Windows
  2. Log into Twitch using Connect Account
  3. Click Save in the Settings dialog
  4. Dock all the Service Integration docks
  5. Press the "X" on the Chat dock specifically, leaving all the others docked
  6. Close OBS
  7. Open OBS

When Qt attempts to apply the saved dockState, it does so by closing the dock too fast, so CEF panics.

Stack trace in the event loop:

image

How Has This Been Tested?

Reproduction steps above on Windows 10.

Without this fix, a crash occurs. With this fix, the Chat dock is correctly hidden, other docks initialise fine, and there's no crash.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@WizardCM WizardCM added the kind/bug Categorizes issue or PR as related to a bug. label Oct 24, 2026
Comment thread panel/browser-panel.cpp Resolved
@PatTheMav

Copy link
Copy Markdown
Member

Change seems good enough for a quick band-aid to me. My current working theory is that the QWindow CEF is supposed to attach to is not in a proper state while the lambda within Init() is executed by the CEF thread (which runs its own independent event loop).

If attached and closed, the dock state of all docks will be restored 3x during OBS startup, which means the chat dock will be closed twice and Qt will also emit a showEvent regardless (this event is even necessary of the browser in the chat dock to be initialised and drop the magic authentication cookie that triggers the initialisation of the other Twitch service docks).


I'd suggest a commit message such as:

Defers the scheduling of browser initialisation to the next iteration of the Qt event loop to allow dock state restoration to finish before CEF will attempt to attach its browser window to the dock's widget hierarchy.

Attempting to initialise a browser immediately will lead to CEF crashing during the same attempt on Windows, as the CEF event loop runs independently and thus might interact with incomplete widget hierarchy.

@github-project-automation github-project-automation Bot moved this from Ready For Review to Ready For Merge in Current Release Tracker (33.0) Oct 27, 2026
@RytoEX
RytoEX force-pushed the fix-startup-integration-crash branch from 46f7f07 to 73b8926 Compare October 27, 2026 16:58
Defers the scheduling of browser initialisation to the next iteration of
the Qt event loop to allow dock state restoration to finish before CEF
will attempt to attach its browser window to the dock's widget
hierarchy.

Attempting to initialize a browser immediately will lead to CEF crashing
during the same attempt on Windows, as the CEF event loop runs
independently and thus might interact with incomplete widget hierarchy.
@RytoEX
RytoEX force-pushed the fix-startup-integration-crash branch from 73b8926 to 38dd02c Compare October 27, 2026 16:59
@RytoEX RytoEX changed the title Initialise dock later to bypass startup crash Initialize dock later to bypass startup crash Oct 27, 2026
@RytoEX
RytoEX merged commit 1cfae9e into obsproject:master Oct 27, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Ready For Merge to Merged in Current Release Tracker (33.0) Oct 27, 2026
@WizardCM
WizardCM deleted the fix-startup-integration-crash branch November 7, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug.

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

OBS Studio 33.0.0 crashes on startup with existing scene collection — libcef.dll

4 participants