UI: Fix frontend API cleanup/exit event order

Makes it so that the exit event is always called regardless of save
state, and that exit is always called after cleanup rather than before.
This commit is contained in:
jp9000 2021-08-15 06:43:17 -07:00
parent decd3c2678
commit 228ca55661
2 changed files with 5 additions and 4 deletions

View file

@ -645,7 +645,8 @@ struct OBSStudioAPI : obs_frontend_callbacks {
void on_event(enum obs_frontend_event event) override
{
if (main->disableSaving &&
event != OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP)
event != OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP &&
event != OBS_FRONTEND_EVENT_SCENE_COLLECTION_EXIT)
return;
for (size_t i = callbacks.size(); i > 0; i--) {

View file

@ -4542,15 +4542,15 @@ void OBSBasic::closeEvent(QCloseEvent *event)
ClearExtraBrowserDocks();
#endif
if (api)
api->on_event(OBS_FRONTEND_EVENT_EXIT);
disableSaving++;
/* Clear all scene data (dialogs, widgets, widget sub-items, scenes,
* sources, etc) so that all references are released before shutdown */
ClearSceneData();
if (api)
api->on_event(OBS_FRONTEND_EVENT_EXIT);
App()->quit();
}