This should fix a bug resulting in a crash, when a IrcUser object was not destroyed...
[quassel.git] / src / common / ircchannel.cpp
index c669d1f..499e1f7 100644 (file)
@@ -56,7 +56,7 @@ bool IrcChannel::isKnownUser(IrcUser *ircuser) const {
     isknown = false;
   }
   
-  if(!_userModes.contains(ircuser) && ircuser) {
+  if(!_userModes.contains(ircuser)) {
     qWarning() << "Channel" << name() << "received data for unknown User" << ircuser->nick();
     isknown = false;
   }
@@ -112,6 +112,7 @@ void IrcChannel::join(IrcUser *ircuser) {
   if(!_userModes.contains(ircuser) && ircuser) {
     _userModes[ircuser] = QString();
     ircuser->joinChannel(name());
+    qDebug() << "JOIN" << name() << ircuser->nick() << ircUsers().count();
     connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickSet(QString)));
     connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed()));
     // if you wonder why there is no counterpart to ircUserJoined:
@@ -128,6 +129,7 @@ void IrcChannel::part(IrcUser *ircuser) {
   if(isKnownUser(ircuser)) {
     _userModes.remove(ircuser);
     ircuser->partChannel(name());
+    qDebug() << "PART" << name() << ircuser->nick() << ircUsers().count();
     // if you wonder why there is no counterpart to ircUserParted:
     // the joines are propagted by the ircuser. the signal ircUserParted is only for convenience
     emit ircUserParted(ircuser);
@@ -208,6 +210,8 @@ void IrcChannel::ircUserDestroyed() {
   IrcUser *ircUser = static_cast<IrcUser *>(sender());
   Q_ASSERT(ircUser);
   _userModes.remove(ircUser);
+  emit ircUserParted(ircUser);
+  qDebug() << "DEST" << name() << ircUsers().count();
 }
 
 void IrcChannel::ircUserNickSet(QString nick) {