Fixes crash when middle clicking dock icon to view msn messages (possibly other cases too)
Index: mainwin.cpp
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/mainwin.cpp,v
retrieving revision 1.316
diff -u -r1.316 mainwin.cpp
--- mainwin.cpp 3 Jun 2004 08:40:19 -0000       1.316
+++ mainwin.cpp 7 Jun 2004 09:36:49 -0000
@@ -2594,6 +2594,7 @@
 //-----CMainWindow::slot_ui_viewevent-------------------------------------------
 void CMainWindow::slot_ui_viewevent(const char *szId)
 {
+  unsigned long nPPID = 0;
   // Do nothing if there are no events pending
   if (ICQUser::getNumUserEvents() == 0 || szId == 0) return;
 
@@ -2621,6 +2622,7 @@
       if (pUser->NewMessages() > 0 && pUser->Touched() <= t)
       {
         szId = pUser->IdString();
+       nPPID = pUser->PPID();
         t = pUser->Touched();
       }
     }
@@ -2632,22 +2634,22 @@
     if (m_bMsgChatView)
     {
       //TODO iterate protocols
-      ICQUser *u = gUserManager.FetchUser(szId, LICQ_PPID, LOCK_R);
+      ICQUser *u = gUserManager.FetchUser(szId, nPPID, LOCK_R);
       for (unsigned short i = 0; i < u->NewMessages(); i++)
       {
         if (u->EventPeek(i)->SubCommand() == ICQ_CMDxSUB_MSG)
         {
           gUserManager.DropUser(u);
-          callFunction(mnuUserSendMsg, szId, LICQ_PPID);
+          callFunction(mnuUserSendMsg, szId, nPPID);
           return;
         }
       }
 
       gUserManager.DropUser(u);
-      callFunction(mnuUserView, szId, LICQ_PPID);
+      callFunction(mnuUserView, szId, nPPID);
     }
     else
-      callFunction(mnuUserView, szId, LICQ_PPID);
+      callFunction(mnuUserView, szId, nPPID);
   }
 }
 

Reply via email to