Skip to content

Commit

Permalink
UI: Restore frontend API events being dispatched during initialization
Browse files Browse the repository at this point in the history
The frontend API events "OBS_FRONTEND_EVENT_SCENE_CHANGED" and
"OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED" are not dispatched if
disableSaving has a value > 0. Prior code decremented disableSaving to
0 globally (regardless of whether saving was necessary, which is only
the case if a new collection is created as a fallback for a missing
scene collection).

Thus the updated code exhibits different event dispatch behavior then
old code which some plugins might have relied on. To avoid introducing
new behavior, explicitly create the environment to allow the dispatch
to take place and remove/refactor the events in a later version.
  • Loading branch information
PatTheMav authored and RytoEX committed Oct 30, 2024
1 parent 23910f4 commit 1cf6b3d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,15 @@ void OBSBasic::OBSInit()
SetupNewSceneCollection(sceneCollectionName);
disableSaving++;
}

disableSaving--;
if (foundCollection || configuredCollection) {
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
}
OnEvent(OBS_FRONTEND_EVENT_SCENE_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
disableSaving++;
}

loaded = true;
Expand Down

0 comments on commit 1cf6b3d

Please sign in to comment.