From b9f72387d577279c04beed5f2eb4491277f75a71 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Mon, 13 Jan 2014 11:15:09 +0100 Subject: [PATCH] fixed crash --- .../frontends/snarlnetwork/snarlnetwork.cpp | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/plugins/frontends/snarlnetwork/snarlnetwork.cpp b/src/plugins/frontends/snarlnetwork/snarlnetwork.cpp index 60266e5..2ca42c0 100644 --- a/src/plugins/frontends/snarlnetwork/snarlnetwork.cpp +++ b/src/plugins/frontends/snarlnetwork/snarlnetwork.cpp @@ -65,12 +65,20 @@ void SnarlNetworkFrontend::actionInvoked(Notification notification){ callback(sn,"SNP/1.1/302/Notification cancelled/"); } } -void SnarlNetworkFrontend::notificationClosed(Notification notification){ - SnarlNotification sn=notifications.value(notification.id()); - if(notification.closeReason() == NotificationEnums::CloseReasons::TIMED_OUT) - callback(sn,"SNP/1.1/303/Notification timed out/"); - else - callback(sn,"SNP/1.1/307/Notification closed/"); +void SnarlNetworkFrontend::notificationClosed(Notification notification) +{ + if(notifications.contains(notification.id())) + { + SnarlNotification sn=notifications.value(notification.id()); + if(notification.closeReason() == NotificationEnums::CloseReasons::TIMED_OUT) + { + callback(sn,"SNP/1.1/303/Notification timed out/"); + } + else + { + callback(sn,"SNP/1.1/307/Notification closed/"); + } + } } void SnarlNetworkFrontend::handleConnection(){ @@ -108,7 +116,8 @@ void SnarlNetworkFrontend::handleMessages(){ } } -void SnarlNetworkFrontend::callback(const SnarlNotification &sn,QString msg){ +void SnarlNetworkFrontend::callback(const SnarlNotification &sn,QString msg) +{ notifications.remove(sn.notification.id()); if(sn.clientSocket!=NULL&&!msg.isEmpty()){ msg+=QString::number(sn.notification.id());