X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=974f31a69eafab040d83d521089a144cb8f1de60;hb=eabcc4905f991bb372cb2fb125b766802366701a;hp=dd5b84862d79b403e0fb8e4d5f05667aa85b9d07;hpb=6ee26fd6d0a163314002616d277e5444f11b7720;p=quassel.git diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index dd5b8486..974f31a6 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -660,8 +660,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(); + } }