Bug 340014 - kMail crashes when opening a new main window if the original (first) main window has been closed
Summary: kMail crashes when opening a new main window if the original (first) main win...
Status: REOPENED
Alias: None
Product: kmail2
Classification: Applications
Component: UI (show other bugs)
Version: 5.2.3
Platform: Kubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 341712 341938 342329 346257 347236 349178 357150 375330 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-16 08:55 UTC by Gunter Ohrner
Modified: 2021-06-20 17:10 UTC (History)
9 users (show)

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 Gunter Ohrner 2014-10-16 08:55:56 UTC
kMail crashes if a new main window should be opened but the original, first main window has been closed before.

Reproducible: Always

Steps to Reproduce:
1. Start kMail
2. Open a new main window using File->New->Main Window
3. Close the first (original) main window.
4. Chose File->New->Main Window again, in the newly opened main window => crash

Actual Results:  
kMail crashes.

Expected Results:  
kMail should not crash and a new, second main window should appear.

Application: KMail (kmail), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f75977d6800 (LWP 7300))]

Thread 6 (Thread 0x7f756f8a9700 (LWP 7303)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f758957e81d in WTF::TCMalloc_PageHeap::scavengerThread() () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#2  0x00007f758957e859 in WTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#3  0x00007f75923fc182 in start_thread (arg=0x7f756f8a9700) at pthread_create.c:312
#4  0x00007f7594b3afbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 5 (Thread 0x7f752e0aa700 (LWP 7304)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f75892bf20d in JSC::BlockAllocator::blockFreeingThreadMain() () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#2  0x00007f75895adfd6 in WTF::wtfThreadEntryPoint(void*) () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#3  0x00007f75923fc182 in start_thread (arg=0x7f752e0aa700) at pthread_create.c:312
#4  0x00007f7594b3afbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 4 (Thread 0x7f752d1b2700 (LWP 7305)):
#0  0x00007f7594b2dc6d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f758cb97fe4 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f758cb980ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f75954ca7be in QEventDispatcherGlib::processEvents (this=0x7f75200008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:436
#4  0x00007f759549c0af in QEventLoop::processEvents (this=this@entry=0x7f752d1b1de0, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007f759549c3a5 in QEventLoop::exec (this=this@entry=0x7f752d1b1de0, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007f7595398c5f in QThread::exec (this=<optimized out>) at thread/qthread.cpp:537
#7  0x00007f759539b32f in QThreadPrivate::start (arg=0x228ad60) at thread/qthread_unix.cpp:349
#8  0x00007f75923fc182 in start_thread (arg=0x7f752d1b2700) at pthread_create.c:312
#9  0x00007f7594b3afbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 3 (Thread 0x7f752760f700 (LWP 7306)):
#0  0x00007f7594b2dc6d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f758cb97fe4 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f758cb980ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f75954ca7be in QEventDispatcherGlib::processEvents (this=0x7f751c0008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:436
#4  0x00007f759549c0af in QEventLoop::processEvents (this=this@entry=0x7f752760eda0, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007f759549c3a5 in QEventLoop::exec (this=this@entry=0x7f752760eda0, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007f7595398c5f in QThread::exec (this=this@entry=0x2677b20) at thread/qthread.cpp:537
#7  0x00007f759547d823 in QInotifyFileSystemWatcherEngine::run (this=0x2677b20) at io/qfilesystemwatcher_inotify.cpp:265
#8  0x00007f759539b32f in QThreadPrivate::start (arg=0x2677b20) at thread/qthread_unix.cpp:349
#9  0x00007f75923fc182 in start_thread (arg=0x7f752760f700) at pthread_create.c:312
#10 0x00007f7594b3afbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 2 (Thread 0x7f7526bfd700 (LWP 7308)):
#0  0x00007f7594b328e3 in select () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f759547a171 in QProcessManager::run (this=0x7f7595804540 <processManager()::processManager>) at io/qprocess_unix.cpp:270
#2  0x00007f759539b32f in QThreadPrivate::start (arg=0x7f7595804540 <processManager()::processManager>) at thread/qthread_unix.cpp:349
#3  0x00007f75923fc182 in start_thread (arg=0x7f7526bfd700) at pthread_create.c:312
#4  0x00007f7594b3afbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7f75977d6800 (LWP 7300)):
[KCrash Handler]
#6  QString::operator== (this=0x28002000680103, other=...) at tools/qstring.cpp:2192
#7  0x00007f759732874c in KStatusNotifierItem::setToolTipSubTitle (this=this@entry=0x256dbe0, subTitle=...) at ../../kdeui/notifications/kstatusnotifieritem.cpp:419
#8  0x00007f759655e86e in KMail::KMSystemTray::unreadMail (this=this@entry=0x256dbe0, model=model@entry=0x1e76cc0, parentIndex=...) at ../../kmail/kmsystemtray.cpp:415
#9  0x00007f759655e74d in KMail::KMSystemTray::unreadMail (this=this@entry=0x256dbe0, model=model@entry=0x1e76cc0, parentIndex=...) at ../../kmail/kmsystemtray.cpp:408
#10 0x00007f759655ea25 in KMail::KMSystemTray::initListOfCollection (this=0x256dbe0) at ../../kmail/kmsystemtray.cpp:375
#11 0x00007f759655ef3f in updateSystemTray (this=<optimized out>) at ../../kmail/kmsystemtray.cpp:437
#12 KMail::KMSystemTray::setShowUnreadCount (this=<optimized out>, showUnreadCount=<optimized out>) at ../../kmail/kmsystemtray.cpp:154
#13 0x00007f75965674a5 in KMKernel::toggleSystemTray (this=0x7fff1cf95630) at ../../kmail/kmkernel.cpp:2060
#14 0x00007f7596597bff in KMMainWidget::readConfig (this=this@entry=0x23d1910) at ../../kmail/kmmainwidget.cpp:875
#15 0x00007f75965a6f66 in KMMainWidget::KMMainWidget (this=0x23d1910, parent=<optimized out>, aGUIClient=0x28e65e0, actionCollection=<optimized out>, config=...) at ../../kmail/kmmainwidget.cpp:271
#16 0x00007f7596556ab1 in KMMainWin::KMMainWin (this=this@entry=0x28e6580, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at ../../kmail/kmmainwin.cpp:67
#17 0x00007f7596556e5d in KMMainWin::slotNewMailReader (this=<optimized out>) at ../../kmail/kmmainwin.cpp:156
#18 0x00007f75954b187a in QMetaObject::activate (sender=sender@entry=0xc8d2da0, m=m@entry=0x7f7596478de0 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7fff1cf94400) at kernel/qobject.cpp:3539
#19 0x00007f75959c8a62 in QAction::triggered (this=this@entry=0xc8d2da0, _t1=false) at .moc/release-shared/moc_qaction.cpp:276
#20 0x00007f75959ca433 in QAction::activate (this=this@entry=0xc8d2da0, event=event@entry=QAction::Trigger) at kernel/qaction.cpp:1257
#21 0x00007f7595df8489 in QMenuPrivate::activateCausedStack (this=this@entry=0x86b07d0, causedStack=..., action=action@entry=0xc8d2da0, action_e=action_e@entry=QAction::Trigger, self=self@entry=true) at widgets/qmenu.cpp:1038
#22 0x00007f7595dfc9b9 in QMenuPrivate::activateAction (this=0x86b07d0, action=0xc8d2da0, action_e=action_e@entry=QAction::Trigger, self=self@entry=true) at widgets/qmenu.cpp:1130
#23 0x00007f7595e00385 in QMenu::mouseReleaseEvent (this=this@entry=0x84ff380, e=e@entry=0x7fff1cf94b30) at widgets/qmenu.cpp:2372
#24 0x00007f75972cc665 in KMenu::mouseReleaseEvent (this=0x84ff380, e=0x7fff1cf94b30) at ../../kdeui/widgets/kmenu.cpp:464
#25 0x00007f7595a1e50a in QWidget::event (this=this@entry=0x84ff380, event=event@entry=0x7fff1cf94b30) at kernel/qwidget.cpp:8376
#26 0x00007f7595e007bb in QMenu::event (this=0x84ff380, e=0x7fff1cf94b30) at widgets/qmenu.cpp:2481
#27 0x00007f75959cee2c in QApplicationPrivate::notify_helper (this=this@entry=0x1cefa90, receiver=receiver@entry=0x84ff380, e=e@entry=0x7fff1cf94b30) at kernel/qapplication.cpp:4567
#28 0x00007f75959d55dd in QApplication::notify (this=this@entry=0x7fff1cf95600, receiver=receiver@entry=0x84ff380, e=e@entry=0x7fff1cf94b30) at kernel/qapplication.cpp:4110
#29 0x00007f7597215d1a in KApplication::notify (this=0x7fff1cf95600, receiver=0x84ff380, event=0x7fff1cf94b30) at ../../kdeui/kernel/kapplication.cpp:311
#30 0x00007f759549d4dd in QCoreApplication::notifyInternal (this=0x7fff1cf95600, receiver=receiver@entry=0x84ff380, event=event@entry=0x7fff1cf94b30) at kernel/qcoreapplication.cpp:953
#31 0x00007f75959d4d93 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#32 QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x84ff380, event=event@entry=0x7fff1cf94b30, alienWidget=alienWidget@entry=0x0, nativeWidget=nativeWidget@entry=0x84ff380, buttonDown=buttonDown@entry=0x7f75964b4318 <qt_button_down>, lastMouseReceiver=..., spontaneous=spontaneous@entry=true) at kernel/qapplication.cpp:3178
#33 0x00007f7595a49cfc in QETWidget::translateMouseEvent (this=this@entry=0x84ff380, event=event@entry=0x7fff1cf94e80) at kernel/qapplication_x11.cpp:4568
#34 0x00007f7595a49269 in QApplication::x11ProcessEvent (this=0x7fff1cf95600, event=event@entry=0x7fff1cf94e80) at kernel/qapplication_x11.cpp:3627
#35 0x00007f7595a70b02 in x11EventSourceDispatch (s=0x1d0a130, callback=0x0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#36 0x00007f758cb97e04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007f758cb98048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007f758cb980ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#39 0x00007f75954ca7a1 in QEventDispatcherGlib::processEvents (this=0x1c08af0, flags=...) at kernel/qeventdispatcher_glib.cpp:434
#40 0x00007f7595a70bb6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#41 0x00007f759549c0af in QEventLoop::processEvents (this=this@entry=0x7fff1cf95250, flags=...) at kernel/qeventloop.cpp:149
#42 0x00007f759549c3a5 in QEventLoop::exec (this=this@entry=0x7fff1cf95250, flags=...) at kernel/qeventloop.cpp:204
#43 0x00007f75954a1b79 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225
#44 0x00007f75959cd37c in QApplication::exec () at kernel/qapplication.cpp:3828
#45 0x0000000000402d18 in main (argc=<optimized out>, argv=<optimized out>) at ../../kmail/main.cpp:146
Comment 1 Gunter Ohrner 2016-01-20 14:51:56 UTC
The feature to be able to open multiple mail windows has simply been removed from kMail to get rid of bugs like this...

So technically it's not fixed, but it also cannot be reproduced any more...
Comment 2 Denis Kurz 2017-01-20 21:47:25 UTC
*** Bug 375330 has been marked as a duplicate of this bug. ***
Comment 3 Denis Kurz 2017-01-20 21:47:27 UTC
*** Bug 341712 has been marked as a duplicate of this bug. ***
Comment 4 Denis Kurz 2017-01-20 21:47:32 UTC
*** Bug 341938 has been marked as a duplicate of this bug. ***
Comment 5 Denis Kurz 2017-01-20 21:47:35 UTC
*** Bug 346257 has been marked as a duplicate of this bug. ***
Comment 6 Denis Kurz 2017-01-20 21:47:42 UTC
*** Bug 342329 has been marked as a duplicate of this bug. ***
Comment 7 Denis Kurz 2017-01-20 21:47:47 UTC
*** Bug 349178 has been marked as a duplicate of this bug. ***
Comment 8 Denis Kurz 2017-01-20 21:47:57 UTC
*** Bug 347236 has been marked as a duplicate of this bug. ***
Comment 9 Denis Kurz 2017-01-20 21:48:07 UTC
*** Bug 357150 has been marked as a duplicate of this bug. ***
Comment 10 Denis Kurz 2017-01-20 22:09:06 UTC
Actually, this bug was reported for much more recent versions, although the way to trigger it is not the same.

I think I have a rough idea what happened: When a new KMail instance is created, its KMSystemTray is created as a copy from another KMSystemTray. This class has a raw d-pointer, but no copy control. Now when one of the instances is destroyed, the other has a dangling d-pointer.

That's just an educated guess, though. I'm still very confused by the gigantic pim codebase, so I might have missed several important details.

The duplicate bug 375330 was reported for 5.2.3.
Comment 11 Justin Zobel 2020-12-17 05:26:15 UTC
Thank you for the crash report.

As it has been a while since this was reported, can you please test and confirm if this issue is still occurring or if this bug report can be marked as resolved.

I have set the bug status to "needsinfo" pending your response, please change back to "reported" or "resolved/worksforme" when you respond, thank you.
Comment 12 Gunter Ohrner 2020-12-17 14:35:06 UTC
I'm not using kMail any more since a few years, as it was just too unreliable.

More than once I had the problem that I suddenly ended up with a non-working email program after upgrades to a KDE bugfix or next stable release due to some obscure Akonadi and other problems.


However, as far as I remember, the feature "File->New->Main Window" was removed from kMail alltogether to "fix" other issues the occured in relation to multiple main windows. As I was used to work with those before, it was quite a set-back back then.

So maybe the original issue here is not relevant any more at all, although I don't know about the issues Dennis mentioned in Comment 10 in 2017 - so not sure if this could be closed as "worksforme" or whatever...
Comment 13 David C. Bryant 2021-06-20 17:10:49 UTC
I think this problem has been fixed. I'm using Gentoo Packages, KMail 5.16.3, Plasma 5.21.5, Frameworks %.82.0, Qt 5.15.2.

The menu item "File --> New --> Main Widow" has been removed. Simply starting KMail, then saying "kmail" in a terminal window won't fire up a second instance of the program. But "d-bus-launch kmail" will start a second (and a third) instance of the program.

I fiddled around with this for a bit, and could not get any of the instances of KMail to crash. I could navigate to different folders / messages. I ran "qps" (traces process ids, like a GUI version of "top"). I saw multiple instances of the akonadi server running, which might eventually cause a problem. Memory usage was pretty high. Killing the extra instances of kmail left "phantom" instances of akonadi hanging around ... I'm too lazy to try killing them one by one, so will probably just reboot to clean up the process tree..

The only really odd thing I noticed is that the system tray icon was not recreated when I opened a second main KMail window. And if I "quit" from the system tray, the second instance of KMail keeps on running.

Does anybody have any objection to marking this bug "resolved"?