common: Avoid crash on SignalProxy destruction
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 25 Sep 2018 22:47:14 +0000 (00:47 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 1 Oct 2018 17:06:49 +0000 (19:06 +0200)
Since SignalProxy itself attaches a slot, it will try to detach
itself on destruction, leading to a crash. Avoid this by checking
for self-detachment.

src/common/signalproxy.cpp

index 3ac73bc..5e5f59d 100644 (file)
@@ -475,8 +475,11 @@ void SignalProxy::synchronize(SyncableObject *obj)
 
 void SignalProxy::detachObject(QObject *obj)
 {
-    detachSignals(obj);
-    detachSlots(obj);
+    // Don't try to connect SignalProxy from itself on shutdown
+    if (obj != this) {
+        detachSignals(obj);
+        detachSlots(obj);
+    }
 }