UI: Destroy the frontend API after OBS_FRONTEND_EVENT_EXIT
The frontend API was never explicitly cleaned up which has lead to several crashes from plugins continuing to call it even after OBS itself has been destroyed. We now destroy the API after the exit event, so further calls by plugins will be no-ops instead of potentially accessing destroyed OBS state. This also required some changes to our own use of the API, as we relied on the OBSBasic destructor to clean up some callbacks, by which point the API should have already been destroyed.
This commit is contained in:
parent
f7eb634788
commit
d997a56fb6
5 changed files with 11 additions and 9 deletions
|
|
@ -5076,6 +5076,10 @@ void OBSBasic::closeEvent(QCloseEvent *event)
|
|||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_EXIT);
|
||||
|
||||
// Destroys the frontend API so plugins can't continue calling it
|
||||
obs_frontend_set_callbacks_internal(nullptr);
|
||||
api = nullptr;
|
||||
|
||||
QMetaObject::invokeMethod(App(), "quit", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue