Skip to content

frontend: Cleanup some theme variable handling#13260

Open
Warchamp7 wants to merge 4 commits intoobsproject:masterfrom
Warchamp7:theme-stack-overflow-fix
Open

frontend: Cleanup some theme variable handling#13260
Warchamp7 wants to merge 4 commits intoobsproject:masterfrom
Warchamp7:theme-stack-overflow-fix

Conversation

@Warchamp7
Copy link
Copy Markdown
Member

Description

Some adjustments to how theme variables are handled to try and solve a weird crash on startup reported on Discord.

Motivation and Context

A user on Discord reported an issue with 32.0.4 where trying to open OBS simply did nothing. The process would start and then exit before any window was shown.

The various data directories for OBS were being created, but no log file was generated. This suggested the failure was somewhere inside OBSApp::AppInit(). After guiding them through the steps to generate a DMP file using ProcDump, the WinDbg analysis revealed a stack overflow inside OBSApp_Themes.cpp due to recursive alternating calls between EvalMath and ParseMathVariable.

Looking at the stack frames showed the following

0:000> dx -r1 *(OBSThemeVariable*)0x26594b75820
*(OBSThemeVariable*)0x26594b75820                 [Type: OBSThemeVariable]
    [+0x000] editable         : true [Type: bool]
    [+0x008] suffix           [Type: QString]
    [+0x020] type             : Color (0) [Type: OBSThemeVariable::VariableType]
    [+0x028] name             [Type: QString]
    [+0x040] value            [Type: QVariant]
    [+0x060] userValue        [Type: QVariant]
0:000> dx -r1 *(OBSThemeVariable*)0x26594b75700
*(OBSThemeVariable*)0x26594b75700                 [Type: OBSThemeVariable]
    [+0x000] editable         : true [Type: bool]
    [+0x008] suffix           [Type: QString]
    [+0x020] type             : -**1414812757** [Type: OBSThemeVariable::VariableType]    <----------
    [+0x028] name             [Type: QString]
    [+0x040] value            [Type: QVariant]
    [+0x060] userValue        [Type: QVariant]
0:000> dx -r1 *(OBSThemeVariable*)0x26594b755e0
*(OBSThemeVariable*)0x26594b755e0                 [Type: OBSThemeVariable]
    [+0x000] editable         : true [Type: bool]
    [+0x008] suffix           [Type: QString]
    [+0x020] type             : -**1802246144** [Type: OBSThemeVariable::VariableType]    <----------
    [+0x028] name             [Type: QString]
    [+0x040] value            [Type: QVariant]
    [+0x060] userValue        [Type: QVariant]

AI Disclosure: An LLM was used to assist with analyzing the DMP file using WinDbg

The invalid type values here led to me looking for ways OBSThemeVariable could be uninitialized or partially initialized.

I also cleaned up some other potential pitfalls in the code here, including our recursion guard that was not working correctly in this instance.

How Has This Been Tested?

The same user has tested this build and was able to launch OBS thanks to the fixed recursion check.

I am not sure that whatever bug is causing this issue in the first place has been resolved.

Types of changes

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

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The 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 Bug Fix Non-breaking change which fixes an issue label Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Fix Non-breaking change which fixes an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants