From 6caeebd5efc96fc12a3f03d91f601398c469878c Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Mon, 19 Mar 2018 17:30:30 +0100 Subject: [PATCH] catch exception when core not valid anymore --- src/chat/chat-room/client-group-chat-room.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp index e1a9e2846..1ae05c8d0 100644 --- a/src/chat/chat-room/client-group-chat-room.cpp +++ b/src/chat/chat-room/client-group-chat-room.cpp @@ -225,7 +225,12 @@ ClientGroupChatRoom::~ClientGroupChatRoom () { L_D(); L_D_T(RemoteConference, dConference); - getCore()->getPrivate()->remoteListEventHandler->removeHandler(dConference->eventHandler.get()); + try { + if (getCore()->getPrivate()->remoteListEventHandler) + getCore()->getPrivate()->remoteListEventHandler->removeHandler(dConference->eventHandler.get()); + } catch (const bad_weak_ptr &) { + // Unable to unregister listener here. Core is destroyed and the listener doesn't exist. + } d->setCallSessionListener(nullptr); }