Bug 99458 - notification list 'New Contact' crash
Summary: notification list 'New Contact' crash
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-15 16:10 UTC by _
Modified: 2010-07-01 16:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ 2005-02-15 16:10:40 UTC
Version:           cvs (using KDE KDE 3.3.92)
Installed from:    Gentoo Packages
Compiler:          gcc 3.4.3 
OS:                Linux

Konversation crashes when you use the 'New Contact' feature in the context menu of someone in the notification list.
Furthermore the 'New Contact' name is inconsistent: other places it is called 'Create New Contact' in a submenu for associations.

Backtrace from KCrash:
Using host libthread_db library "/lib/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1227753808 (LWP 30943)]
0xffffe410 in ?? ()
#0  0xffffe410 in ?? ()
#1  0x469704a0 in _IO_list_all () from /lib/libc.so.6
#2  0x00000000 in ?? ()
#3  0x00000000 in ?? ()
#4  0x46ad34ab in __waitpid_nocancel () from /lib/libpthread.so.0
#5  0xb7737816 in KCrash::defaultCrashHandler ()
   from /usr/kde/3.4/lib/libkdecore.so.4
#6  0x083dfc68 in ?? ()
#7  0xb7832620 in kde_malloc_is_used () from /usr/kde/3.4/lib/libkdecore.so.4
#8  0xb7832620 in kde_malloc_is_used () from /usr/kde/3.4/lib/libkdecore.so.4
#9  0x00000004 in ?? ()
#10 0x086e4420 in ?? ()
#11 0xb77d6430 in free () from /usr/kde/3.4/lib/libkdecore.so.4
#12 0x08ba7aa0 in ?? ()
#13 0x08ba7aa0 in ?? ()
#14 0x000078f7 in ?? ()
#15 0x00000400 in ?? ()
#16 0x00000400 in ?? ()
#17 0xb7feb374 in ?? () from /usr/kde/3.4/lib/libkabc.so.1
#18 0xb77d6430 in free () from /usr/kde/3.4/lib/libkdecore.so.4
#19 0x08ba7aa0 in ?? ()
#20 0x083dfc70 in ?? ()
#21 0xbfffde08 in ?? ()
#22 0xb7ed4151 in operator delete ()
   from //usr/lib/gcc/i686-pc-linux-gnu/3.4.3/libstdc++.so.6
Comment 1 Ismail Donmez 2005-03-02 08:39:02 UTC
Can you please recompile with --enable-debug=full and re-post the backtrace?
Comment 2 Ismail Donmez 2005-03-30 21:47:42 UTC
Mark can you please give us a useful backtrace?
Comment 3 Peter Simonsson 2005-04-01 17:38:56 UTC
CVS commit by psn: 

* Don't crash on New Contact
* Rename New Contact to Create New Contact
* Reindent the code as it was unreadable

BUG:99458


  M +3 -3      nicklistviewitem.cpp   1.45
  M +47 -31    nicksonline.cpp   1.90
Comment 4 Peter Simonsson 2010-07-01 16:02:00 UTC
commit 29a3195c150d0e626a8054e27ef4a0234497118f
Author: Peter Simonsson <peter.simonsson@gmail.com>
Date:   Fri Apr 1 15:38:48 2005 +0000

    * Don't crash on New Contact
    * Rename New Contact to Create New Contact
    * Reindent the code as it was unreadable
    
    BUG:99458
    
    svn path=/trunk/kdeextragear-2/konversation/; revision=402428

diff --git a/konversation/nicklistviewitem.cpp b/konversation/nicklistviewitem.cpp
index 7d47313..ad01f97 100644
--- a/konversation/nicklistviewitem.cpp
+++ b/konversation/nicklistviewitem.cpp
@@ -179,9 +179,9 @@ void NickListViewItem::paintCell(QPainter * p, const QColorGroup & cg, int colum
   NickInfo* nickInfo = nick->getNickInfo();
 
   if(nickInfo->isAway())
-    {
-      cg2 = kapp->palette().disabled();
-    }
+  {
+    cg2 = kapp->palette().disabled();
+  }
 
   QListViewItem::paintCell(p,cg2,column,width,align);
 }
diff --git a/konversation/nicksonline.cpp b/konversation/nicksonline.cpp
index 06fa1b2..d89d994 100644
--- a/konversation/nicksonline.cpp
+++ b/konversation/nicksonline.cpp
@@ -603,50 +603,64 @@ QListViewItem* NicksOnline::getServerAndNickItem(const QString& serverName,
 */
 void NicksOnline::doCommand(int id)
 {
-    if (id < 0) return;
+    if(id < 0) {
+        return;
+    }
+
     QString serverName;
     QString nickname;
     QListViewItem* item = m_nickListView->selectedItem();
-    if (!getItemServerAndNick(item, serverName, nickname)) return;
+
+    if(!getItemServerAndNick(item, serverName, nickname)) {
+        return;
+    }
+
     // Get the server object corresponding to the server name.
-    KonversationApplication *konvApp =
-        static_cast<KonversationApplication *>(KApplication::kApplication());
+    KonversationApplication *konvApp = static_cast<KonversationApplication *>(kapp);
     Server* server = konvApp->getServerByName(serverName);
-    if (!server) return;
+
+    if(!server) {
+        return;
+    }
+
     // Get NickInfo object corresponding to the nickname.
     NickInfoPtr nickInfo = server->getNickInfo(nickname);
     // Get addressbook entry for the nick.
     KABC::Addressee addressee;
-    if (nickInfo)
+
+    if(nickInfo) {
         addressee = nickInfo->getAddressee();
-    else
+    } else {
         addressee = server->getOfflineNickAddressee(nickname);
+    }
 
     switch(id)
     {
-	case(ciSendEmail):
-          Konversation::Addressbook::self()->sendEmail(addressee);
-	  return; //no need to refresh item
-	case(ciAddressbookEdit):
-          Konversation::Addressbook::self()->editAddressee(addressee.uid());
-	  return; //no need to refresh item - nickinfo changed will be called anyway.
-	case(ciAddressbookChange):
-	  if(nickInfo)
-            nickInfo->showLinkAddressbookUI();
-	  else {
-            LinkAddressbookUI *linkaddressbookui = new LinkAddressbookUI(server->getMainWindow(), NULL, nickname, server->getServerName(), server->getServerGroup(), addressee.realName());
-            linkaddressbookui->show();
-	  }
-	  break;
-
-	case ciAddressbookNew:
+        case ciSendEmail:
+            Konversation::Addressbook::self()->sendEmail(addressee);
+            return; //no need to refresh item
+        case ciAddressbookEdit:
+            Konversation::Addressbook::self()->editAddressee(addressee.uid());
+            return; //no need to refresh item - nickinfo changed will be called anyway.
+        case ciAddressbookChange:
+            if(nickInfo) {
+                nickInfo->showLinkAddressbookUI();
+            } else {
+                LinkAddressbookUI *linkaddressbookui = new LinkAddressbookUI(server->getMainWindow(), NULL, nickname, server->getServerName(), server->getServerGroup(), addressee.realName());
+                linkaddressbookui->show();
+            }
+            break;
+        case ciAddressbookNew:
         case ciAddressbookDelete:
         {
             Konversation::Addressbook *addressbook = Konversation::Addressbook::self();
-            if(addressbook->getAndCheckTicket())
-            {
+
+            if(addressbook && addressbook->getAndCheckTicket()) {
                 if(id == ciAddressbookDelete) {
-                    if (addressee.isEmpty()) return;
+                    if (addressee.isEmpty()) {
+                      return;
+                    }
+
                     addressbook->unassociateNick(addressee, nickname, server->getServerName(), server->getServerGroup());
                 } else {
                     addressee.setGivenName(nickname);
@@ -656,13 +670,14 @@ void NicksOnline::doCommand(int id)
                 if(addressbook->saveTicket())
                 {
                     //saveTicket will refresh the addressees for us.
-                    if(id == ciAddressbookNew)
-                       Konversation::Addressbook::self()->editAddressee(nickInfo->getAddressee().uid());
+                    if(id == ciAddressbookNew) {
+                        Konversation::Addressbook::self()->editAddressee(addressee.uid());
+                    }
                 }
             }
             break;
         }
-       case ciJoinChannel:
+        case ciJoinChannel:
         {
             // Channels have no nlvcServerName entry.
             // We test if it is empty to see if we really have a channel name.
@@ -677,6 +692,7 @@ void NicksOnline::doCommand(int id)
             server->queue("WHOIS "+nickname);
             return;
     }
+
     refreshItem(item);
 }
 
@@ -734,7 +750,7 @@ void NicksOnline::setupAddressbookButtons(int nickState)
         }
         case nsNoAddress:
         {
-            m_editContactButton->setText(i18n("New C&ontact..."));
+            m_editContactButton->setText(i18n("Create New C&ontact..."));
             m_editContactButton->setEnabled(true);
             m_changeAssociationButton->setText(i18n("&Choose Association..."));
             m_changeAssociationButton->setEnabled(true);
@@ -800,7 +816,7 @@ void NicksOnline::slotNickListView_RightButtonClicked(QListViewItem* item, const
         case nsNoAddress:
         {
             m_popupMenu->insertItem(i18n("&Choose Association..."), ciAddressbookChange);
-            m_popupMenu->insertItem(i18n("New C&ontact..."), ciAddressbookNew);
+            m_popupMenu->insertItem(i18n("Create New C&ontact..."), ciAddressbookNew);
             m_popupMenu->insertSeparator();
             m_popupMenu->insertItem(i18n("&Whois"), ciWhois);
             if (item->text(nlvcServerName).isEmpty())