mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
websocketserver: Check for EventHandler validity in de/constructor
Redundant fix for shutdown crash
This commit is contained in:
parent
efeae8d640
commit
07537a33fa
@ -49,14 +49,21 @@ WebSocketServer::WebSocketServer() : QObject(nullptr)
|
||||
websocketpp::lib::placeholders::_2));
|
||||
|
||||
auto eventHandler = GetEventHandler();
|
||||
if (eventHandler) {
|
||||
eventHandler->SetBroadcastCallback(std::bind(&WebSocketServer::BroadcastEvent, this, std::placeholders::_1,
|
||||
std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
|
||||
|
||||
eventHandler->SetObsReadyCallback(std::bind(&WebSocketServer::onObsReady, this, std::placeholders::_1));
|
||||
}
|
||||
}
|
||||
|
||||
WebSocketServer::~WebSocketServer()
|
||||
{
|
||||
auto eventHandler = GetEventHandler();
|
||||
if (eventHandler) {
|
||||
eventHandler->SetObsReadyCallback(nullptr);
|
||||
eventHandler->SetBroadcastCallback(nullptr);
|
||||
}
|
||||
|
||||
if (_server.is_listening())
|
||||
Stop();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user