mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
eventhandler: Disconnect signals from all public sources on shutdown
Fixes crash on shutdown when memory leaks lead to un-destroyed sources after plugin shutdown.
This commit is contained in:
parent
4ff109b62b
commit
efeae8d640
@ -54,6 +54,20 @@ EventHandler::~EventHandler()
|
||||
blog(LOG_ERROR, "[EventHandler::~EventHandler] Unable to get libobs signal handler!");
|
||||
}
|
||||
|
||||
// Revoke callbacks of all inputs and scenes, in case some still have our callbacks attached
|
||||
auto enumInputs = [](void *param, obs_source_t *source) {
|
||||
auto eventHandler = static_cast<EventHandler *>(param);
|
||||
eventHandler->DisconnectSourceSignals(source);
|
||||
return true;
|
||||
};
|
||||
obs_enum_sources(enumInputs, this);
|
||||
auto enumScenes = [](void *param, obs_source_t *source) {
|
||||
auto eventHandler = static_cast<EventHandler *>(param);
|
||||
eventHandler->DisconnectSourceSignals(source);
|
||||
return true;
|
||||
};
|
||||
obs_enum_scenes(enumScenes, this);
|
||||
|
||||
blog_debug("[EventHandler::~EventHandler] Finished.");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user