Bug 136365

Summary: Crash on exit in autoSaveMessage
Product: [Unmaintained] kmail Reporter: Marcin Gryszkalis <mg>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: bugs2, m.wege
Priority: NOR    
Version: 1.9.5   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Marcin Gryszkalis 2006-10-26 23:59:49 UTC
Version:           1.9.5 (using KDE KDE 3.5.5)
Installed from:    Gentoo Packages
Compiler:          gcc 4.1.1 
OS:                Linux

It crashed upon exit, here's the backtrace, the important line is (I guess)
#24 0xb7cd27d8 in KMComposeWin::autoSaveMessage (this=0xe147e50)
    at kmcomposewin.cpp:699


#13 0xb51dd470 in *__GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#14 0xb51deb9e in *__GI_abort () at abort.c:88
#15 0xb721a714 in __gnu_cxx::__verbose_terminate_handler ()
   from /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libstdc++.so.6
#16 0xb7218105 in __cxxabiv1::__terminate ()
   from /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libstdc++.so.6
#17 0xb7218142 in std::terminate ()
   from /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libstdc++.so.6
#18 0xb721827a in __cxa_throw ()
   from /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libstdc++.so.6
#19 0xb72186bb in operator new ()
   from /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libstdc++.so.6
#20 0xb721878d in operator new[] ()
   from /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libstdc++.so.6
#21 0xb7cd4f7f in QValueVectorPrivate (this=0x8e04c50, x=@0x8fea598)
    at /usr/qt/3/include/qvaluevector.h:124
#22 0xb7cd4ff5 in QValueVector<KMMessage*>::detachInternal (this=0xe147f80)
    at /usr/qt/3/include/qvaluevector.h:499
#23 0xb7cd50b0 in QValueVector<KMMessage*>::front (this=0xe147f80)
    at /usr/qt/3/include/qvaluevector.h:369
#24 0xb7cd27d8 in KMComposeWin::autoSaveMessage (this=0xe147e50)
    at kmcomposewin.cpp:699
#25 0xb7cd2145 in KMComposeWin::qt_invoke (this=0xe147e50, _id=143,
    _o=0xbf8e257c) at kmcomposewin.moc:467
#26 0xb5a06f03 in QObject::activate_signal (this=0x8f51b28, clist=0x9593050,
    o=0xbf8e257c) at kernel/qobject.cpp:2356
#27 0xb5a07c9c in QObject::activate_signal (this=0x8f51b28, signal=2)
    at kernel/qobject.cpp:2325
#28 0xb5e0610a in QTimer::timeout (this=0x8f51b28)
    at .moc/debug-shared-mt/moc_qtimer.cpp:82
#29 0xb5a35805 in QTimer::event (this=0x8f51b28, e=0xbf8e28a8)
    at kernel/qtimer.cpp:219
#30 0xb5992703 in QApplication::internalNotify (this=0xbf8e2b34,
    receiver=0x8f51b28, e=0xbf8e28a8) at kernel/qapplication.cpp:2635
#31 0xb599467b in QApplication::notify (this=0xbf8e2b34, receiver=0x8f51b28,
    e=0xbf8e28a8) at kernel/qapplication.cpp:2358
#32 0xb624cca6 in KApplication::notify (this=0xbf8e2b34, receiver=0x8f51b28,
    event=0xbf8e28a8) at kapplication.cpp:550
#33 0xb770666f in QApplication::sendEvent (receiver=0x8f51b28,
    event=0xbf8e28a8) at /usr/qt/3/include/qapplication.h:496
#34 0xb5983518 in QEventLoop::activateTimers (this=0x8084a80)
    at kernel/qeventloop_unix.cpp:556
#35 0xb5932d4f in QEventLoop::processEvents (this=0x8084a80, flags=4)
    at kernel/qeventloop_x11.cpp:389
#36 0xb59b071d in QEventLoop::enterLoop (this=0x8084a80)
    at kernel/qeventloop.cpp:198
#37 0xb59b053e in QEventLoop::exec (this=0x8084a80)
    at kernel/qeventloop.cpp:145
#38 0xb59943c7 in QApplication::exec (this=0xbf8e2b34)
    at kernel/qapplication.cpp:2758
#39 0x0804a922 in main (argc=) at main.cpp:110
Comment 1 Marcin Gryszkalis 2007-02-25 23:20:08 UTC
Happened again, in kde 3.5.6 (kmail 1.9.6)

Using host libthread_db library "/lib/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1256039712 (LWP 31808)]
[New Thread -1289581680 (LWP 31813)]
[New Thread -1281188976 (LWP 31812)]
[New Thread -1272796272 (LWP 31811)]
[New Thread -1264403568 (LWP 31810)]
[KCrash handler]
#6  0xb7c29b4b in DwString::c_str (this=0xb534d109)
    at ../mimelib/mimelib/string.h:620
#7  0xb7c19c1c in KMMessage::asString (this=0xa8a97c8) at kmmessage.cpp:309
#8  0xb7cbe41e in KMComposeWin::autoSaveMessage (this=0x80fc1a0)
    at kmcomposewin.cpp:709
#9  0xb7cbd9cf in KMComposeWin::qt_invoke (this=0x80fc1a0, _id=145, 
    _o=0xbf829fdc) at kmcomposewin.moc:473
#10 0xb5a51ecf in QObject::activate_signal (this=0xa820f00, clist=0xa0ba270, 
    o=0xbf829fdc) at kernel/qobject.cpp:2356
#11 0xb5a52c68 in QObject::activate_signal (this=0xa820f00, signal=2)
    at kernel/qobject.cpp:2325
#12 0xb5e510ee in QTimer::timeout (this=0xa820f00)
    at .moc/debug-shared-mt/moc_qtimer.cpp:82
#13 0xb5a807d1 in QTimer::event (this=0xa820f00, e=0xbf82a308)
    at kernel/qtimer.cpp:219
#14 0xb59dd5ff in QApplication::internalNotify (this=0xbf82a590, 
    receiver=0xa820f00, e=0xbf82a308) at kernel/qapplication.cpp:2635
#15 0xb59df577 in QApplication::notify (this=0xbf82a590, receiver=0xa820f00, 
    e=0xbf82a308) at kernel/qapplication.cpp:2358
#16 0xb62c81c6 in KApplication::notify (this=0xbf82a590, receiver=0xa820f00, 
    event=0xbf82a308) at kapplication.cpp:550
#17 0xb76ac61f in QApplication::sendEvent (receiver=0xa820f00, 
    event=0xbf82a308) at /usr/qt/3/include/qapplication.h:496
#18 0xb59ce414 in QEventLoop::activateTimers (this=0x8089548)
    at kernel/qeventloop_unix.cpp:556
#19 0xb597dd97 in QEventLoop::processEvents (this=0x8089548, flags=4)
    at kernel/qeventloop_x11.cpp:389
#20 0xb59fb619 in QEventLoop::enterLoop (this=0x8089548)
    at kernel/qeventloop.cpp:198
#21 0xb59fb43a in QEventLoop::exec (this=0x8089548)
    at kernel/qeventloop.cpp:145
#22 0xb59df2c3 in QApplication::exec (this=0xbf82a590)
    at kernel/qapplication.cpp:2758
#23 0x0804a912 in main (argc=176584064, argv=0x9dcb398) at main.cpp:110
Comment 2 Thomas McGuire 2007-03-27 20:15:33 UTC
Does the message you are composing have an attachment?
If yes, how big is it?
Comment 3 Marcin Gryszkalis 2007-03-28 00:02:08 UTC
I can't repeat this now - I forgot order of clicks, I'll try again later
Comment 4 Tommi Tervo 2007-04-03 11:24:18 UTC
*** Bug 143385 has been marked as a duplicate of this bug. ***
Comment 5 Thomas McGuire 2007-04-03 13:23:54 UTC
These crashes are are all related to autoSaveMessage, but do not seem exactly the same: bug 143776, bug 136365, bug 108312.
Comment 6 Bram Schoenmakers 2007-06-04 22:52:02 UTC
*** Bug 146368 has been marked as a duplicate of this bug. ***
Comment 7 Bruno Virlet 2007-07-24 16:25:44 UTC
> I can't repeat this now - I forgot order of clicks, I'll try again later 
You're talking about a click order, even if you don't remember this order, what are the clicks you're talking about ?

And also, did your message have an attachement ? or was it empty ?
Comment 8 Marcin Gryszkalis 2007-07-24 16:50:23 UTC
I don't remember if it had attachement.

I also don't remember what actions caused this bug - I don't know when auto-save is  called - btw. I think now kmail's behavior is not consistent (File/Quit in main Kmail window leaves composer windows open).

Comment 9 Bruno Virlet 2007-08-13 15:06:10 UTC
SVN commit 699554 by bvirlet:

Fixes event loop bug. Credit goes to Dirk.


BUG: 108312
BUG: 148700
BUG: 143003
BUG: 136365
BUG: 90467

Most probably closed:
BUG: 143776
BUG: 147016
BUG: 137279
BUG: 136413

https://bugzilla.novell.com/show_bug.cgi?id=226462


 M  +10 -17    kmcomposewin.cpp  
 M  +1 -1      kmcomposewin.h  


--- branches/KDE/3.5/kdepim/kmail/kmcomposewin.cpp #699553:699554
@@ -709,16 +709,22 @@
 
   if ( mAutoSaveTimer )
     mAutoSaveTimer->stop();
+
   connect( this, SIGNAL( applyChangesDone( bool ) ),
-           this, SLOT( slotContinueAutoSave( bool ) ) );
+           this, SLOT( slotContinueAutoSave() ) );
   // This method is called when KMail crashed, so don't try signing/encryption
   // and don't disable controls because it is also called from a timer and
   // then the disabling is distracting.
   applyChanges( true, true );
 
   // Don't continue before the applyChanges is done!
-  qApp->enter_loop();
+}
 
+void KMComposeWin::slotContinueAutoSave()
+{
+  disconnect( this, SIGNAL( applyChangesDone( bool ) ),
+              this, SLOT( slotContinueAutoSave( bool ) ) );
+
   // Ok, it's done now - continue dead letter saving
   if ( mComposedMessages.isEmpty() ) {
     kdDebug(5006) << "Composing the message failed." << endl;
@@ -761,16 +767,9 @@
   }
 
   if ( autoSaveInterval() > 0 )
-    mAutoSaveTimer->start( autoSaveInterval() );
+    updateAutoSave();
 }
 
-void KMComposeWin::slotContinueAutoSave( bool )
-{
-  disconnect( this, SIGNAL( applyChangesDone( bool ) ),
-              this, SLOT( slotContinueAutoSave( bool ) ) );
-  qApp->exit_loop();
-}
-
 //-----------------------------------------------------------------------------
 void KMComposeWin::slotView(void)
 {
@@ -2193,18 +2192,12 @@
 {
   kdDebug(5006) << "entering KMComposeWin::applyChanges" << endl;
 
-  if(!mMsg) {
+  if(!mMsg || mComposer) {
     kdDebug(5006) << "KMComposeWin::applyChanges() : mMsg == 0!\n" << endl;
     emit applyChangesDone( false );
     return;
   }
 
-  if( mComposer ) {
-    kdDebug(5006) << "KMComposeWin::applyChanges() : applyChanges called twice"
-                  << endl;
-    return;
-  }
-
   // Make new job and execute it
   mComposer = new MessageComposer( this );
   connect( mComposer, SIGNAL( done( bool ) ),
--- branches/KDE/3.5/kdepim/kmail/kmcomposewin.h #699553:699554
@@ -780,7 +780,7 @@
 
   void slotContinueDoSend( bool );
   void slotContinuePrint( bool );
-  void slotContinueAutoSave( bool );
+  void slotContinueAutoSave();
 
   void slotEncryptChiasmusToggled( bool );