Don't crash after displaying a connection error popup
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 21 Nov 2013 23:39:29 +0000 (00:39 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 21 Nov 2013 23:43:08 +0000 (00:43 +0100)
Error popups are modal dialogs running a nested event loop, which means
that events will continue to be processed while the popup is showing.
In this particular case, the socket would close, and the authhandler calling
the popup synchronously would be deleted, leading to a segfault when closing
the popup.

Making this a queued connection prevents this from happening, as control is
not going to be returned to the deleted authhandler that way.

src/client/coreconnection.cpp

index 7725d86..d077e24 100644 (file)
@@ -456,7 +456,7 @@ void CoreConnection::connectToCurrentAccount()
     connect(_authHandler, SIGNAL(requestDisconnect(QString,bool)), SLOT(disconnectFromCore(QString,bool)));
 
     connect(_authHandler, SIGNAL(errorMessage(QString)), SIGNAL(connectionError(QString)));
-    connect(_authHandler, SIGNAL(errorPopup(QString)), SIGNAL(connectionErrorPopup(QString)));
+    connect(_authHandler, SIGNAL(errorPopup(QString)), SIGNAL(connectionErrorPopup(QString)), Qt::QueuedConnection);
     connect(_authHandler, SIGNAL(statusMessage(QString)), SIGNAL(connectionMsg(QString)));
     connect(_authHandler, SIGNAL(encrypted(bool)), SIGNAL(encrypted(bool)));
     connect(_authHandler, SIGNAL(startCoreSetup(QVariantList)), SIGNAL(startCoreSetup(QVariantList)));