Compare commits

...

3 Commits
5.3.3 ... 5.3.4

Author SHA1 Message Date
e8089a5bbf base: Update version to 5.3.4
- eventhandler: Disconnect signals from all public sources on shutdown
- websocketserver: Check for EventHandler validity in de/constructor
2023-12-05 14:15:04 -05:00
07537a33fa websocketserver: Check for EventHandler validity in de/constructor
Redundant fix for shutdown crash
2023-11-14 00:07:05 -08:00
efeae8d640 eventhandler: Disconnect signals from all public sources on shutdown
Fixes crash on shutdown when memory leaks lead to un-destroyed
sources after plugin shutdown.
2023-11-14 00:07:05 -08:00
4 changed files with 27 additions and 6 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16...3.25)
legacy_check() legacy_check()
set(obs-websocket_VERSION 5.3.3) set(obs-websocket_VERSION 5.3.4)
set(OBS_WEBSOCKET_RPC_VERSION 1) set(OBS_WEBSOCKET_RPC_VERSION 1)
option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON) option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON)

View File

@ -1,4 +1,4 @@
project(obs-websocket VERSION 5.3.3) project(obs-websocket VERSION 5.3.4)
set(OBS_WEBSOCKET_RPC_VERSION 1) set(OBS_WEBSOCKET_RPC_VERSION 1)
option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON) option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON)

View File

@ -54,6 +54,20 @@ EventHandler::~EventHandler()
blog(LOG_ERROR, "[EventHandler::~EventHandler] Unable to get libobs signal handler!"); 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."); blog_debug("[EventHandler::~EventHandler] Finished.");
} }

View File

@ -49,14 +49,21 @@ WebSocketServer::WebSocketServer() : QObject(nullptr)
websocketpp::lib::placeholders::_2)); websocketpp::lib::placeholders::_2));
auto eventHandler = GetEventHandler(); auto eventHandler = GetEventHandler();
if (eventHandler) {
eventHandler->SetBroadcastCallback(std::bind(&WebSocketServer::BroadcastEvent, this, std::placeholders::_1, eventHandler->SetBroadcastCallback(std::bind(&WebSocketServer::BroadcastEvent, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3, std::placeholders::_4)); std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
eventHandler->SetObsReadyCallback(std::bind(&WebSocketServer::onObsReady, this, std::placeholders::_1)); eventHandler->SetObsReadyCallback(std::bind(&WebSocketServer::onObsReady, this, std::placeholders::_1));
}
} }
WebSocketServer::~WebSocketServer() WebSocketServer::~WebSocketServer()
{ {
auto eventHandler = GetEventHandler();
if (eventHandler) {
eventHandler->SetObsReadyCallback(nullptr);
eventHandler->SetBroadcastCallback(nullptr);
}
if (_server.is_listening()) if (_server.is_listening())
Stop(); Stop();
} }