X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=dc985bd81a0731083eb4767c741c4e9c21c3b4ca;hp=10e7575fa119c9b46fafe68e42cd426bc8b80445;hb=44212b2131e958c40ca26b9f49289590d8f83145;hpb=a6c419727506abd19f41d8de6e02de015a7aa8e5 diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 10e7575f..dc985bd8 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -153,7 +153,7 @@ void NetworkItem::attachNetwork(Network *network) connect(network, SIGNAL(connectedSet(bool)), this, SIGNAL(networkDataChanged())); connect(network, SIGNAL(destroyed()), - this, SIGNAL(networkDataChanged())); + this, SLOT(onNetworkDestroyed())); emit networkDataChanged(); } @@ -233,6 +233,14 @@ void NetworkItem::onBeginRemoveChilds(int start, int end) } +void NetworkItem::onNetworkDestroyed() +{ + _network = 0; + emit networkDataChanged(); + removeAllChilds(); +} + + /***************************************** * Fancy Buffer Items *****************************************/ @@ -520,6 +528,7 @@ void QueryBufferItem::setIrcUser(IrcUser *ircUser) } if (ircUser) { + connect(ircUser, SIGNAL(destroyed(QObject*)), SLOT(removeIrcUser())); connect(ircUser, SIGNAL(quited()), this, SLOT(removeIrcUser())); connect(ircUser, SIGNAL(awaySet(bool)), this, SIGNAL(dataChanged())); connect(ircUser, SIGNAL(encryptedSet(bool)), this, SLOT(setEncrypted(bool))); @@ -595,10 +604,15 @@ QString ChannelBufferItem::toolTip(int column) const void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel) { - Q_ASSERT(!_ircChannel && ircChannel); + if (_ircChannel) { + qWarning() << Q_FUNC_INFO << "IrcChannel already set; cleanup failed!?"; + disconnect(_ircChannel, 0, this, 0); + } _ircChannel = ircChannel; + connect(ircChannel, SIGNAL(destroyed(QObject*)), + this, SLOT(ircChannelDestroyed())); connect(ircChannel, SIGNAL(topicSet(QString)), this, SLOT(setTopic(QString))); connect(ircChannel, SIGNAL(encryptedSet(bool)), @@ -633,6 +647,16 @@ void ChannelBufferItem::ircChannelParted() } +void ChannelBufferItem::ircChannelDestroyed() +{ + if (_ircChannel) { + _ircChannel = 0; + emit dataChanged(); + removeAllChilds(); + } +} + + void ChannelBufferItem::join(const QList &ircUsers) { addUsersToCategory(ircUsers);