Skip to content

Commit

Permalink
obs-frontend-api: Add scripting shutdown event
Browse files Browse the repository at this point in the history
This event is for when scripts need to know when OBS is exiting.
Currently scripts are destroyed before the current exit event.
cg2121 authored and jp9000 committed Nov 15, 2021
1 parent a65287d commit 8d349ea
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions UI/obs-frontend-api/obs-frontend-api.h
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ enum obs_frontend_event {
OBS_FRONTEND_EVENT_TBAR_VALUE_CHANGED,
OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING,
OBS_FRONTEND_EVENT_PROFILE_CHANGING,
OBS_FRONTEND_EVENT_SCRIPTING_SHUTDOWN,
};

/* ------------------------------------------------------------------------- */
3 changes: 3 additions & 0 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
@@ -4590,6 +4590,9 @@ void OBSBasic::closeEvent(QCloseEvent *event)
ClearExtraBrowserDocks();
#endif

if (api)
api->on_event(OBS_FRONTEND_EVENT_SCRIPTING_SHUTDOWN);

disableSaving++;

/* Clear all scene data (dialogs, widgets, widget sub-items, scenes,
4 changes: 4 additions & 0 deletions docs/sphinx/reference-frontend-api.rst
Original file line number Diff line number Diff line change
@@ -93,6 +93,10 @@ Structures/Enumerations

Triggered when a profile has been added/removed/renamed.

- **OBS_FRONTEND_EVENT_SCRIPTING_SHUTDOWN**

Triggered when scripts are unloaded when exiting OBS.

- **OBS_FRONTEND_EVENT_EXIT**

Triggered when the program is about to exit.

0 comments on commit 8d349ea

Please sign in to comment.