Skip to content

Commit

Permalink
eventhandler: Disconnect signals from all public sources on shutdown
Browse files Browse the repository at this point in the history
Fixes crash on shutdown when memory leaks lead to un-destroyed
sources after plugin shutdown.
  • Loading branch information
tt2468 committed Nov 14, 2023
1 parent 4ff109b commit efeae8d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/eventhandler/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}

Expand Down

0 comments on commit efeae8d

Please sign in to comment.