X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=89c658a9f6d8ead47ac8448e43b539b2d225e365;hb=08b63f9c94aa33200d9373eadad13c130c3095b4;hp=11b96f3929a9bdc19d597520d7c6ac10f4354bfb;hpb=fa2b53c2a77d8fcae8e12d358465d6e3786769ca;p=quassel.git diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 11b96f39..89c658a9 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -554,8 +554,22 @@ void QueryBufferItem::setIrcUser(IrcUser *ircUser) void QueryBufferItem::removeIrcUser() { - _ircUser = 0; - emit dataChanged(); + if (_ircUser) { + // Disconnect the active IrcUser before removing it, otherwise it will fire removeIrcUser() + // a second time when the object's destroyed due to QueryBufferItem::setIrcUser() connecting + // SIGNAL destroyed(QObject*) to SLOT removeIrcUser(). + // This fixes removing an active IrcUser if the user had quit then rejoined in a nonstandard + // manner (e.g. updateNickFromHost calling newIrcUser, triggered by an away-notify message). + disconnect(_ircUser, 0, this, 0); + + // Clear IrcUser (only set to 0 if not already 0) + _ircUser = 0; + + // Only emit dataChanged() if data actually changed. This might serve as a small + // optimization, but it can be moved outside the if statement if other behavior depends on + // it always being called. + emit dataChanged(); + } }