mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
frontend: Only emit frontend events for existing scene collection
To emit frontend events early during OBS' initialization, the disableSaving state variable needs to be "falsy" (as events will not be emitted otherwise). The code path taken for generating a new fallback scene collection has disableSaving decremented to "enable" saving (and thus frontend events) already, so it's just the code paths for existing collections that need this workaround. Emitting the scene changed and preview scene changed events when a fallback scene collection has been created has side-effects when OBS Studio is set to studio mode and can lead to potential crashes, as the studio mode is still in an invalid state at this point.
This commit is contained in:
@@ -1035,14 +1035,14 @@ void OBSBasic::OBSInit()
|
||||
disableSaving++;
|
||||
}
|
||||
|
||||
disableSaving--;
|
||||
if (foundCollection || configuredCollection) {
|
||||
disableSaving--;
|
||||
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++;
|
||||
}
|
||||
OnEvent(OBS_FRONTEND_EVENT_SCENE_CHANGED);
|
||||
OnEvent(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
|
||||
disableSaving++;
|
||||
}
|
||||
|
||||
loaded = true;
|
||||
|
||||
Reference in New Issue
Block a user