Bug 279749

Summary: Kontact crashed when trying to open gpg encripted email
Product: [Applications] kdepim Reporter: Hrvoje Senjan <hrvoje.senjan>
Component: messagecoreAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED WORKSFORME    
Severity: crash CC: azure.satellite, brian, bugs-kde, dragonk, gmazzurco89, h6zb8-kdebugs20120801, itsef-admin, janow49420, manz, montel, nyblom, ot.an, rdieter, rhasti, samir, sgrubb, sskyman, thomas, vamp898, zuber
Priority: NOR    
Version: 4.9   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
Yet another crash while browsing through GPGed messages
Patch to solve the bug entirely
Patch to solve the bug entirely

Description Hrvoje Senjan 2011-08-09 15:23:22 UTC
Application: kontact (4.7.0 )
KDE Platform Version: 4.7.00 (4.7.0)
Qt Version: 4.7.2
Operating System: Linux 2.6.38-10-generic x86_64
Distribution: Ubuntu 11.04

-- Information about the crash:
- What I was doing when the application crashed:

Kontact crashed when trying to open gpg encripted email, didn't try again

-- Backtrace:
Application: Kontact (kontact), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f7fd5da37a0 (LWP 31901))]

Thread 3 (Thread 0x7f7fbda06700 (LWP 31915)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f7fd27fa832 in ?? () from /usr/lib/libQtWebKit.so.4
#2  0x00007f7fcda79d8c in start_thread (arg=0x7f7fbda06700) at pthread_create.c:304
#3  0x00007f7fd337c04d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f7facc38700 (LWP 32028)):
#0  0xffffffffff60017b in ?? ()
#1  0x00007f7facc37ac0 in ?? ()
#2  0x00007fffb07ff7b2 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0x7f7fd5da37a0 (LWP 31901)):
[KCrash Handler]
#6  KMime::Content::parent (this=0x3a98d70) at ../../kmime/kmime_content.cpp:915
#7  0x00007f7fb81ea305 in MessageCore::NodeHelper::nextSibling (node=0x3a98d70) at ../../messagecore/nodehelper.cpp:32
#8  0x00007f7fb6b0fd09 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=0x7fffb07a5840, node=0x3a98d70) at ../../messageviewer/objecttreeparser.cpp:278
#9  0x00007f7fb6b45fff in MessageViewer::ViewerPrivate::parseContent (this=0x17abd10, content=0x3a98d70) at ../../messageviewer/viewer_p.cpp:839
#10 0x00007f7fb6b48d74 in MessageViewer::ViewerPrivate::displayMessage (this=0x17abd10) at ../../messageviewer/viewer_p.cpp:711
#11 0x00007f7fb6b4955a in MessageViewer::ViewerPrivate::updateReaderWin (this=0x17abd10) at ../../messageviewer/viewer_p.cpp:1920
#12 0x00007f7fb6b4c6ad in MessageViewer::ViewerPrivate::qt_metacall (this=0x17abd10, _c=QMetaObject::InvokeMetaMethod, _id=27, _a=0x7fffb07a5d20) at ./viewer_p.moc:220
#13 0x00007f7fd47415f8 in QMetaObject::activate (sender=0x17abd98, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x0) at kernel/qobject.cpp:3287
#14 0x00007f7fd47401c9 in QObject::event (this=0x17abd98, e=<value optimized out>) at kernel/qobject.cpp:1190
#15 0x00007f7fd3ae99f4 in QApplicationPrivate::notify_helper (this=0x1062100, receiver=0x17abd98, e=0x7fffb07a6420) at kernel/qapplication.cpp:4462
#16 0x00007f7fd3aee3ba in QApplication::notify (this=<value optimized out>, receiver=0x17abd98, e=0x7fffb07a6420) at kernel/qapplication.cpp:4341
#17 0x00007f7fd5156c16 in KApplication::notify (this=0x7fffb07a6700, receiver=0x17abd98, event=0x7fffb07a6420) at ../../kdeui/kernel/kapplication.cpp:311
#18 0x00007f7fd472c49c in QCoreApplication::notifyInternal (this=0x7fffb07a6700, receiver=0x17abd98, event=0x7fffb07a6420) at kernel/qcoreapplication.cpp:731
#19 0x00007f7fd4759f12 in sendEvent (this=0x106cdd0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#20 QTimerInfoList::activateTimers (this=0x106cdd0) at kernel/qeventdispatcher_unix.cpp:604
#21 0x00007f7fd4756cf4 in timerSourceDispatch (source=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:184
#22 0x00007f7fccfb1bcd in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007f7fccfb23a8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007f7fccfb2639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007f7fd47573ef in QEventDispatcherGlib::processEvents (this=0x1009370, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:422
#26 0x00007f7fd3b934de in QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#27 0x00007f7fd472b882 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#28 0x00007f7fd472babc in QEventLoop::exec (this=0x7fffb07a6690, flags=...) at kernel/qeventloop.cpp:201
#29 0x00007f7fd472fecb in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1008
#30 0x0000000000403ff8 in main (argc=1, argv=<value optimized out>) at ../../../kontact/src/main.cpp:218

Reported using DrKonqi
Comment 1 Laurent Montel 2011-09-30 11:04:46 UTC
I fixed some bugs in 4.7.1-4.7.2 could you retry with new version please ?
Comment 2 Hrvoje Senjan 2011-09-30 11:39:40 UTC
Laurent, i tried opening two encrypted messages, and didn't get any crash. Using kdepim/libs/runtime from KDE/4.7 branch (few days old). You can close the bug report, hopefully this is solved :)
Comment 3 Laurent Montel 2011-09-30 13:03:21 UTC
I close it :)
Comment 4 Christophe Marin 2011-10-20 11:00:41 UTC
*** Bug 284521 has been marked as a duplicate of this bug. ***
Comment 5 Christophe Marin 2011-10-20 11:01:47 UTC
Reopen:

from bug 284521 (kmail 4.7.2)

-- Information about the crash:
- What I was doing when the application crashed:

I have a folder with encrypted messages.

When opening this folder the first time after logging in or when opening it
with a new encrypted message it crashes.

After restarting kmail (but without logging off) i can read the encrypted mail.

The crash can be reproduced some of the time.
Comment 6 janow49420 2011-10-27 08:03:52 UTC
Created attachment 64934 [details]
New crash information added by DrKonqi

kontact (4.7.2) on KDE Platform 4.7.2 (4.7.2) using Qt 4.7.4

- What I was doing when the application crashed:
I opened an email that was encrypted and then kmail crashed on me.

- Unusual behavior I noticed:
Not sure if it's related but previously I opened some emails and was getting that pesky error:

Encrypted message (decryption not possible)
Reason: Crypto plug-in "OpenPGP" could not decrypt the data.
Error: Bad passphrase

That could be related to something else though.

-- Backtrace (Reduced):
#6  0x00007f0f35cbc164 in KMime::Content::parent (this=0x20d8bb0) at ../../kmime/kmime_content.cpp:921
#7  0x00007f0edda1f995 in MessageCore::NodeHelper::nextSibling (node=0x20d8bb0) at ../../messagecore/nodehelper.cpp:32
#8  0x00007f0edc33b067 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=0x7fffb2744730, node=0x20d8bb0) at ../../messageviewer/objecttreeparser.cpp:278
#9  0x00007f0edc36f8df in MessageViewer::ViewerPrivate::parseContent (this=0x1141d40, content=0x20d8bb0) at ../../messageviewer/viewer_p.cpp:857
#10 0x00007f0edc372434 in MessageViewer::ViewerPrivate::displayMessage (this=0x1141d40) at ../../messageviewer/viewer_p.cpp:729
Comment 7 Christophe Marin 2011-11-18 23:01:59 UTC
*** Bug 286024 has been marked as a duplicate of this bug. ***
Comment 8 Albert Astals Cid 2011-11-22 09:08:59 UTC
Ok, here comes how to actually reproduce the crash every time:
 * Open kmail
 * Select a gpg encrypted email
 * Wait until the dialog asking for the passphrase shows up
 * While the dialog is open, select a different email in kmail (also different from the one you initially had before selecting the gpg email)
 * Click cancel in the passphrase dialog
 * Crash
Comment 9 Vamp898 2011-12-07 09:20:34 UTC
Created attachment 66465 [details]
New crash information added by DrKonqi

kontact (4.7.2) on KDE Platform 4.7.2 (4.7.2) using Qt 4.7.4

I tried to ecnrypt a PGP Message, works fine with Thunderbird and Evolution, KMail crashes.

-- Backtrace (Reduced):
#6  0x00007f4be440c164 in KMime::Content::parent (this=0x1e18010) at ../../kmime/kmime_content.cpp:921
#7  0x00007f4b86e7c995 in MessageCore::NodeHelper::nextSibling (node=0x1e18010) at ../../messagecore/nodehelper.cpp:32
#8  0x00007f4b85798067 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=0x7fff001e0990, node=0x1e18010) at ../../messageviewer/objecttreeparser.cpp:278
#9  0x00007f4b857cc8df in MessageViewer::ViewerPrivate::parseContent (this=0x20c3080, content=0x1e18010) at ../../messageviewer/viewer_p.cpp:857
#10 0x00007f4b857cf434 in MessageViewer::ViewerPrivate::displayMessage (this=0x20c3080) at ../../messageviewer/viewer_p.cpp:729
Comment 10 Gioacchino Mazzurco 2011-12-08 20:45:50 UTC
Created attachment 66518 [details]
New crash information added by DrKonqi

kontact (4.7.3) on KDE Platform 4.7.3 (4.7.3) using Qt 4.7.4

- What I was doing when the application crashed:

I was tryng to open a pgp encripted email

Kontact suddenly crashed after inserting my key passphrase 
My kontact version is 4.7.3

-- Backtrace (Reduced):
#6  0x00007f7d354fe904 in KMime::Content::parent() const () from /usr/lib64/libkmime.so.4
#7  0x00007f7d23ad45b2 in MessageCore::NodeHelper::nextSibling(KMime::Content const*) () from /usr/lib64/libmessagecore.so.4
#8  0x00007f7d223c073e in MessageViewer::ObjectTreeParser::parseObjectTreeInternal(KMime::Content*) () from /usr/lib64/libmessageviewer.so.4
[...]
#14 0x00007f7d3e7aba19 in QObject::event(QEvent*) () from /usr/lib64/qt4/libQtCore.so.4
#15 0x00007f7d3db38dac in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
Comment 11 Christophe Marin 2012-01-12 09:24:03 UTC
*** Bug 291135 has been marked as a duplicate of this bug. ***
Comment 12 DragonK 2012-01-20 14:47:09 UTC
*** Bug 292040 has been marked as a duplicate of this bug. ***
Comment 13 DragonK 2012-01-20 14:48:28 UTC
I can confirm the steps in comment #8 for crash reproduction.
Comment 14 Christophe Marin 2012-02-23 13:40:09 UTC
*** Bug 294612 has been marked as a duplicate of this bug. ***
Comment 15 itsef-admin 2012-03-01 10:08:58 UTC
(In reply to comment #8)
> Ok, here comes how to actually reproduce the crash every time:
>  * Open kmail
>  * Select a gpg encrypted email
>  * Wait until the dialog asking for the passphrase shows up
>  * While the dialog is open, select a different email in kmail (also different
> from the one you initially had before selecting the gpg email)
>  * Click cancel in the passphrase dialog
>  * Crash

I can confirm these steps to reproduce the crash 100%. See also https://bugs.kde.org/show_bug.cgi?id=294612 (which has been marked as duplicate of this bug) for more information.

Also, this bug is very old - it was already present in kmail1 (KDE 3.5.x/Kolab e35) and has also been filed in the Kolab bugtracker.

What makes this bug really annoying is that you run into it very easily if you use the cursor keys to scroll through message lists - if you do it fast enough, 
you're already on the next mail by the time the passphrase dialogue pops up - which means that there is no way of getting out of that situation without having Kontact crash.
Comment 16 itsef-admin 2012-03-01 14:46:42 UTC
WORKAROUND

I found that if I have gpg-agent running (e.g. by adding a script "gpgagent.sh" containing
eval "$(gpg-agent --daemon)"
to $HOME/.kde/env) I can avoid the crash. KMail will then just show the mail with a comment that it cannot decrypt the mail and does not open the passphrase dialogue. Obviously, this does not fix the crash, but at least it prevents the trigger from happening.
Note: I have only started gpg-agent without any further configuration.
Comment 17 Hartmut Manz 2012-03-13 09:12:14 UTC
Created attachment 69568 [details]
New crash information added by DrKonqi

kontact (4.8.0) on KDE Platform 4.8.1 (4.8.1) using Qt 4.8.0

- What I was doing when the application crashed:

This bug is still present in the most recent KMAIL code

Please let me know, how I could help to get this solved

-- Backtrace (Reduced):
#6  0x00007f6d62f6e284 in KMime::Content::parent (this=0x390ad40) at ../../kmime/kmime_content.cpp:928
#7  0x00007f6d08101385 in MessageCore::NodeHelper::nextSibling (node=0x390ad40) at ../../messagecore/nodehelper.cpp:32
#8  0x00007f6d069e2587 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=0x7fff004688f0, node=0x390ad40) at ../../messageviewer/objecttreeparser.cpp:296
#9  0x00007f6d06a13f9f in MessageViewer::ViewerPrivate::parseContent (this=0x29eeec0, content=0x390ad40) at ../../messageviewer/viewer_p.cpp:866
#10 0x00007f6d06a16a14 in MessageViewer::ViewerPrivate::displayMessage (this=0x29eeec0) at ../../messageviewer/viewer_p.cpp:738
Comment 18 Brian Hellman 2012-06-04 19:34:10 UTC
Created attachment 71584 [details]
New crash information added by DrKonqi

kontact (4.8.3) on KDE Platform 4.8.3 (4.8.3) using Qt 4.8.1

- What I was doing when the application crashed:

Opening an encrypted email for the first time. Entered my password, hit return and it crashed.

-- Backtrace (Reduced):
#7  0xb33908b7 in KMime::Content::parent (this=0xc7c52a0) at ../../kmime/kmime_content.cpp:928
#8  0xadac95e0 in MessageCore::NodeHelper::nextSibling (node=0xc7c52a0) at ../../messagecore/nodehelper.cpp:32
#9  0xad5e3ab5 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=0xbfc433a8, node=0xc7c52a0) at ../../messageviewer/objecttreeparser.cpp:296
#10 0xad5e4ae6 in MessageViewer::ObjectTreeParser::parseObjectTree (this=0xbfc433a8, node=0xc7c52a0) at ../../messageviewer/objecttreeparser.cpp:266
#11 0xad61a141 in MessageViewer::ViewerPrivate::parseContent (this=0x9ad4860, content=0xc7c52a0) at ../../messageviewer/viewer_p.cpp:866
Comment 19 itsef-admin 2012-09-06 15:44:51 UTC
This bug is still present in 4.8.4.
Comment 20 itsef-admin 2012-09-06 16:44:24 UTC
Just tried KDE/KMail 4.9.0 from the Kubuntu-Backports PPA - KMail still crashes under the circumstances described above:

Application: Kontact (kontact), signal: Segmentation fault
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0xb77319c0 (LWP 1921))]

Thread 5 (Thread 0xb5932b40 (LWP 1922)):
#0  0x00926416 in __kernel_vsyscall ()
#1  0x0096b96b in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:169
#2  0x00ac73dc in __pthread_cond_wait (cond=0x4224a30, mutex=0x4224a18) at forward.c:139
#3  0x03af3263 in WTF::TCMalloc_PageHeap::scavengerThread (this=0x421f940) at wtf/FastMalloc.cpp:2495
#4  0x03af337f in WTF::TCMalloc_PageHeap::runScavengerThread (context=0x421f940) at wtf/FastMalloc.cpp:1618
#5  0x00967d4c in start_thread (arg=0xb5932b40) at pthread_create.c:308
#6  0x00ab9ace in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 4 (Thread 0xb5011b40 (LWP 1923)):
#0  0x071ac3e4 in g_mutex_lock (mutex=0xb47004e0) at /build/buildd/glib2.0-2.32.3/./glib/gthread-posix.c:210
#1  0x0716d060 in g_main_context_iterate (dispatch=1, block=118991440, context=0xb47004e0, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3150
#2  g_main_context_iterate (context=0xb47004e0, block=118991440, dispatch=1, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3083
#3  0x0716d201 in g_main_context_iteration (context=0xb47004e0, may_block=1) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3207
#4  0x00d49f27 in QEventDispatcherGlib::processEvents (this=0xb4700468, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#5  0x00d157ed in QEventLoop::processEvents (this=0xb5011270, flags=...) at kernel/qeventloop.cpp:149
#6  0x00d15a89 in QEventLoop::exec (this=0xb5011270, flags=...) at kernel/qeventloop.cpp:204
#7  0x00bfe9ec in QThread::exec (this=0x8a750d8) at thread/qthread.cpp:501
#8  0x00bfeadb in QThread::run (this=0x8a750d8) at thread/qthread.cpp:568
#9  0x00c01e80 in QThreadPrivate::start (arg=0x8a750d8) at thread/qthread_unix.cpp:307
#10 0x00967d4c in start_thread (arg=0xb5011b40) at pthread_create.c:308
#11 0x00ab9ace in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 3 (Thread 0xb36ffb40 (LWP 1969)):
#0  0x00b77dcd in __GI_clock_gettime (clock_id=1, tp=0xb36fefb8) at ../sysdeps/unix/clock_gettime.c:116
#1  0x00c603b5 in do_gettime (frac=0xb36fefb0, sec=0xb36fefa8) at tools/qelapsedtimer_unix.cpp:123
#2  qt_gettime () at tools/qelapsedtimer_unix.cpp:140
#3  0x00d4a866 in QTimerInfoList::updateCurrentTime (this=0xb2d02074) at kernel/qeventdispatcher_unix.cpp:343
#4  0x00d4abba in QTimerInfoList::timerWait (this=0xb2d02074, tm=...) at kernel/qeventdispatcher_unix.cpp:450
#5  0x00d49463 in timerSourcePrepareHelper (src=<optimized out>, timeout=0xb36ff0bc) at kernel/qeventdispatcher_glib.cpp:136
#6  0x00d494fd in timerSourcePrepare (source=0xb2d02040, timeout=<optimized out>) at kernel/qeventdispatcher_glib.cpp:169
#7  0x0716c872 in g_main_context_prepare (context=0xb2d004e0, priority=0xb36ff118) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:2836
#8  0x0716cfaf in g_main_context_iterate (dispatch=1, block=1, context=0xb2d004e0, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3126
#9  g_main_context_iterate (context=0xb2d004e0, block=1, dispatch=1, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3083
#10 0x0716d201 in g_main_context_iteration (context=0xb2d004e0, may_block=1) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3207
#11 0x00d49f27 in QEventDispatcherGlib::processEvents (this=0xb2d00468, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#12 0x00d157ed in QEventLoop::processEvents (this=0xb36ff240, flags=...) at kernel/qeventloop.cpp:149
#13 0x00d15a89 in QEventLoop::exec (this=0xb36ff240, flags=...) at kernel/qeventloop.cpp:204
#14 0x00bfe9ec in QThread::exec (this=0x89cc2a0) at thread/qthread.cpp:501
#15 0x00cf2e3d in QInotifyFileSystemWatcherEngine::run (this=0x89cc2a0) at io/qfilesystemwatcher_inotify.cpp:248
#16 0x00c01e80 in QThreadPrivate::start (arg=0x89cc2a0) at thread/qthread_unix.cpp:307
#17 0x00967d4c in start_thread (arg=0xb36ffb40) at pthread_create.c:308
#18 0x00ab9ace in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 2 (Thread 0xb1ce4b40 (LWP 2076)):
#0  0x00926416 in __kernel_vsyscall ()
#1  0x00aa917b in read () at ../sysdeps/unix/syscall-template.S:82
#2  0x071ab6ae in read (__nbytes=16, __buf=0xb1ce407c, __fd=<optimized out>) at /usr/include/i386-linux-gnu/bits/unistd.h:45
#3  g_wakeup_acknowledge (wakeup=0x91a7f50) at /build/buildd/glib2.0-2.32.3/./glib/gwakeup.c:212
#4  0x0716cbd2 in g_main_context_check (context=0xb2d04648, max_priority=2147483647, fds=0xb2d046b8, n_fds=1) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:2980
#5  0x0716d042 in g_main_context_iterate (dispatch=1, block=118991440, context=0xb2d04648, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3143
#6  g_main_context_iterate (context=0xb2d04648, block=118991440, dispatch=1, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3083
#7  0x0716d201 in g_main_context_iteration (context=0xb2d04648, may_block=1) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3207
#8  0x00d49f27 in QEventDispatcherGlib::processEvents (this=0xb2d04278, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#9  0x00d157ed in QEventLoop::processEvents (this=0xb1ce4240, flags=...) at kernel/qeventloop.cpp:149
#10 0x00d15a89 in QEventLoop::exec (this=0xb1ce4240, flags=...) at kernel/qeventloop.cpp:204
#11 0x00bfe9ec in QThread::exec (this=0x9400e98) at thread/qthread.cpp:501
#12 0x00cf2e3d in QInotifyFileSystemWatcherEngine::run (this=0x9400e98) at io/qfilesystemwatcher_inotify.cpp:248
#13 0x00c01e80 in QThreadPrivate::start (arg=0x9400e98) at thread/qthread_unix.cpp:307
#14 0x00967d4c in start_thread (arg=0xb1ce4b40) at pthread_create.c:308
#15 0x00ab9ace in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 1 (Thread 0xb77319c0 (LWP 1921)):
[KCrash Handler]
#7  0x05b70bb7 in KMime::Content::parent (this=0x9896570) at ../../kmime/kmime_content.cpp:949
#8  0x05307660 in MessageCore::NodeHelper::nextSibling (node=0x9896570) at ../../messagecore/nodehelper.cpp:32
#9  0x0612f475 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=0xbfb9ad98, node=0x9896570) at ../../messageviewer/objecttreeparser.cpp:296
#10 0x061304a6 in MessageViewer::ObjectTreeParser::parseObjectTree (this=0xbfb9ad98, node=0x9896570) at ../../messageviewer/objecttreeparser.cpp:266
#11 0x06165331 in MessageViewer::ViewerPrivate::parseContent (this=0x8ddbf40, content=0x9896570) at ../../messageviewer/viewer_p.cpp:999
#12 0x061667f7 in MessageViewer::ViewerPrivate::displayMessage (this=0x8ddbf40) at ../../messageviewer/viewer_p.cpp:871
#13 0x06167040 in MessageViewer::ViewerPrivate::updateReaderWin (this=0x8ddbf40) at ../../messageviewer/viewer_p.cpp:2228
#14 0x061705cd in MessageViewer::ViewerPrivate::qt_static_metacall (_o=0x8ddbf40, _c=QMetaObject::InvokeMetaMethod, _id=32, _a=0xbfb9b050) at ./viewer_p.moc:221
#15 0x00d2dcf1 in QMetaObject::activate (sender=0x8ddbf88, m=0xe754d8, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3547
#16 0x00d80c65 in QTimer::timeout (this=0x8ddbf88) at .moc/release-shared/moc_qtimer.cpp:148
#17 0x00d36ba6 in QTimer::timerEvent (this=0x8ddbf88, e=0xbfb9b55c) at kernel/qtimer.cpp:280
#18 0x00d32104 in QObject::event (this=0x8ddbf88, e=0xbfb9b55c) at kernel/qobject.cpp:1157
#19 0x014cedf4 in notify_helper (e=0xbfb9b55c, receiver=0x8ddbf88, this=0x899d868) at kernel/qapplication.cpp:4556
#20 QApplicationPrivate::notify_helper (this=0x899d868, receiver=0x8ddbf88, e=0xbfb9b55c) at kernel/qapplication.cpp:4528
#21 0x014d415d in QApplication::notify (this=0xbfb9b55c, receiver=0x8ddbf88, e=0xbfb9b55c) at kernel/qapplication.cpp:4285
#22 0x0113ce41 in KApplication::notify (this=0xbfb9b864, receiver=0x8ddbf88, event=0xbfb9b55c) at ../../kdeui/kernel/kapplication.cpp:311
#23 0x00d16f4e in QCoreApplication::notifyInternal (this=0xbfb9b864, receiver=0x8ddbf88, event=0xbfb9b55c) at kernel/qcoreapplication.cpp:915
#24 0x00d4bfd0 in sendEvent (event=0xbfb9b55c, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#25 QTimerInfoList::activateTimers (this=0x899e6b4) at kernel/qeventdispatcher_unix.cpp:611
#26 0x00d49738 in timerSourceDispatch (source=0x899e680) at kernel/qeventdispatcher_glib.cpp:186
#27 timerSourceDispatch (source=0x899e680) at kernel/qeventdispatcher_glib.cpp:180
#28 0x0716cd86 in g_main_dispatch (context=0x899db90) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:2539
#29 g_main_context_dispatch (context=0x899db90) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3075
#30 0x0716d125 in g_main_context_iterate (dispatch=1, block=118991440, context=0x899db90, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3146
#31 g_main_context_iterate (context=0x899db90, block=118991440, dispatch=1, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3083
#32 0x0716d201 in g_main_context_iteration (context=0x899db90, may_block=1) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3207
#33 0x00d49ec7 in QEventDispatcherGlib::processEvents (this=0x89737e8, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#34 0x01587a1a in QGuiEventDispatcherGlib::processEvents (this=0x89737e8, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#35 0x00d157ed in QEventLoop::processEvents (this=0xbfb9b7c4, flags=...) at kernel/qeventloop.cpp:149
#36 0x00d15a89 in QEventLoop::exec (this=0xbfb9b7c4, flags=...) at kernel/qeventloop.cpp:204
#37 0x00d1b48a in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#38 0x014cc9c4 in QApplication::exec () at kernel/qapplication.cpp:3817
#39 0x0804ac51 in main (argc=0, argv=0x0) at ../../../kontact/src/main.cpp:219
Comment 21 Myriam Schweingruber 2012-09-07 00:25:26 UTC
Setting status to confirmed.
Comment 22 Jekyll Wu 2012-09-26 07:19:49 UTC
*** Bug 307425 has been marked as a duplicate of this bug. ***
Comment 23 Jekyll Wu 2012-10-15 05:59:37 UTC
*** Bug 308420 has been marked as a duplicate of this bug. ***
Comment 24 Thomas Baag 2013-01-14 04:35:43 UTC
Created attachment 76458 [details]
New crash information added by DrKonqi

kontact (4.9.3) on KDE Platform 4.9.3 using Qt 4.8.3

- What I was doing when the application crashed:
Opened Kontact , than kontact by itself jumps to an encrypted mail (for which i once canceld the password dialog and maybe it crashed back then) and wants to know the password to decrypt it. Annoyed of its behavior i try to cancel the dialog and switch to another email before it comes back again. And then it crashes. Not every time, but pretty often.

- Unusual behavior I noticed:
Kontacts wants so hardly to decrypt this mail. I can cancel the dialog and select another email, if i dont do angry-clicking and it didn't crash. Then graceful close Kontact, but after starting it again it pops back to the encrypted mail and starts annoying me again.

- Custom settings of the application:
I obviously using it with encryption (gpg) enabled.


Another nice feature: If kontact greets you with password prompt after opening it, then try to open the menu dialog just a second before the password dialog pops up. You will get a pretty messed up deadlock-situation where no more input is accept. Had to change to tty-vt and killall kontact to unlock my x session. Did it twice, because a wanted to know the kontact version and have some problems with waiting.

-- Backtrace (Reduced):
#6  0x00007f8025b54174 in KMime::Content::parent (this=0x2b470f0) at ../../kmime/kmime_content.cpp:949
#7  0x00007f7fcac0d106 in MessageCore::NodeHelper::nextSibling (node=0x2b470f0) at ../../messagecore/nodehelper.cpp:32
#8  0x00007f7fc94eca54 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=this@entry=0x7fff43ad25a0, node=node@entry=0x2b470f0) at ../../messageviewer/objecttreeparser.cpp:296
#9  0x00007f7fc94ecf27 in MessageViewer::ObjectTreeParser::stdChildHandling (this=this@entry=0x7fff43ad2810, child=0x2b470f0) at ../../messageviewer/objecttreeparser.cpp:1452
#10 0x00007f7fc94ed342 in processMultiPartMixedSubtype (node=0x2b20140, this=0x7fff43ad2810) at ../../messageviewer/objecttreeparser.cpp:1485
Comment 25 Tobias 2013-04-23 16:53:45 UTC
Created attachment 79395 [details]
New crash information added by DrKonqi

kmail (4.10.2) on KDE Platform 4.10.2 using Qt 4.8.2

- What I was doing when the application crashed:
I clicked on a encrypted message and the gpg-agent dialog popped up. I hit cancel and also cancel on the second dialog which pops up afterwards.

-- Backtrace (Reduced):
#6  0x00007f980e7794d4 in KMime::Content::parent (this=0x7c87c00) at ../../kmime/kmime_content.cpp:952
#7  0x00007f980de71005 in MessageCore::NodeHelper::nextSibling (node=0x7c87c00) at ../../messagecore/nodehelper.cpp:32
#8  0x00007f980ae083d7 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=0x7fffef2f8600, node=0x7c87c00) at ../../messageviewer/objecttreeparser.cpp:296
#9  0x00007f980ae3a55f in MessageViewer::ViewerPrivate::parseContent (this=0x2b435f0, content=0x7c87c00) at ../../messageviewer/viewer_p.cpp:974
#10 0x00007f980ae3b82e in MessageViewer::ViewerPrivate::displayMessage (this=0x2b435f0) at ../../messageviewer/viewer_p.cpp:846
Comment 26 Alejandro 2013-07-18 14:15:17 UTC
Created attachment 81180 [details]
New crash information added by DrKonqi

kmail (4.10.4) on KDE Platform 4.10.4 using Qt 4.8.4

- What I was doing when the application crashed:

I was canceling the decrypt message dialog option that appears whenever kmail tries to open a pgp encrypted message.

-- Backtrace (Reduced):
#6  0x00007fe1df6740c4 in KMime::Content::parent (this=this@entry=0x3c6f3e0) at ../../kmime/kmime_content.cpp:952
#7  0x00007fe1ded84f16 in MessageCore::NodeHelper::nextSibling (node=node@entry=0x3c6f3e0) at ../../messagecore/nodehelper.cpp:32
#8  0x00007fe1dbd6c586 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=this@entry=0x7fff471899c0, node=node@entry=0x3c6f3e0) at ../../messageviewer/objecttreeparser.cpp:296
#9  0x00007fe1dbd6d259 in MessageViewer::ObjectTreeParser::parseObjectTree (this=this@entry=0x7fff471899c0, node=node@entry=0x3c6f3e0) at ../../messageviewer/objecttreeparser.cpp:266
#10 0x00007fe1dbda04c0 in MessageViewer::ViewerPrivate::parseContent (this=this@entry=0x213f9d0, content=0x3c6f3e0) at ../../messageviewer/viewer_p.cpp:974
Comment 27 Carioca 2013-07-28 06:57:02 UTC
Created attachment 81400 [details]
New crash information added by DrKonqi

kontact (4.10.5) on KDE Platform 4.10.5 using Qt 4.8.4

- What I was doing when the application crashed:

I clicked at a GPG-encrypted e-mail and cancelled both dialogues that asked for the password. Then Kontact crashed.

-- Backtrace (Reduced):
#6  0x00007f319b9ad0c4 in KMime::Content::parent (this=this@entry=0x42a5c20) at ../../kmime/kmime_content.cpp:952
#7  0x00007f313f231f16 in MessageCore::NodeHelper::nextSibling (node=node@entry=0x42a5c20) at ../../messagecore/nodehelper.cpp:32
#8  0x00007f313d8b8586 in MessageViewer::ObjectTreeParser::parseObjectTreeInternal (this=this@entry=0x7fffb5039bb0, node=node@entry=0x42a5c20) at ../../messageviewer/objecttreeparser.cpp:296
#9  0x00007f313d8b9259 in MessageViewer::ObjectTreeParser::parseObjectTree (this=this@entry=0x7fffb5039bb0, node=node@entry=0x42a5c20) at ../../messageviewer/objecttreeparser.cpp:266
#10 0x00007f313d8ec4c0 in MessageViewer::ViewerPrivate::parseContent (this=this@entry=0x1c77350, content=0x42a5c20) at ../../messageviewer/viewer_p.cpp:974
Comment 28 Jekyll Wu 2013-09-22 14:43:02 UTC
*** Bug 325175 has been marked as a duplicate of this bug. ***
Comment 29 Jekyll Wu 2013-10-23 01:18:55 UTC
*** Bug 326449 has been marked as a duplicate of this bug. ***
Comment 30 itsef-admin 2013-10-23 07:23:26 UTC
Created attachment 83044 [details]
Yet another crash while browsing through GPGed messages

This bug is *still* present in 4.11.2 (Kubuntu 13.10) - and it's annoying as ever!
Comment 31 itsef-admin 2013-10-23 07:56:48 UTC
(In reply to comment #16)
> WORKAROUND
> I found that if I have gpg-agent running (e.g. by adding a script
> "gpgagent.sh" containing
> eval "$(gpg-agent --daemon)"
> to $HOME/.kde/env) I can avoid the crash.

Apparently, this workaround no longer works with KDE 4.11.2/Kubuntu 13.10 - at the moment there is no way to avoid this crash!
Comment 32 itsef-admin 2013-10-23 07:59:31 UTC
(In reply to comment #31)
> (In reply to comment #16)
> > WORKAROUND
> > I found that if I have gpg-agent running (e.g. by adding a script
> > "gpgagent.sh" containing
> > eval "$(gpg-agent --daemon)"
> > to $HOME/.kde/env) I can avoid the crash.
> 
> Apparently, this workaround no longer works with KDE 4.11.2/Kubuntu 13.10 -
> at the moment there is no way to avoid this crash!

Oops, my bad, the workaround still works <phew>.
Comment 33 Tobias N. 2013-12-29 15:31:06 UTC
Hi,
this bug is IMHO somehow related to bug 96498, as the crash happens only if the warning "Danger, recursion while displaying a message!" is written from ViewerPrivate::updateReaderWin(), which is part of the bug-fix for 96498.

My sequence of user-actions and kmail-output for the crash is:
- Select an encrypted e-mail, so that it shall be shown in the viewer (this can even be directly after launching KMail, if the mail selected in the last KMail-session is encrypted)
- The warning "Danger, recursion while displaying a message!" is written from ViewerPrivate::updateReaderWin() -- if this warning does not appear, KMail will not crash
- The dialog to enter the passphrase is shown
- User closes the dialog (does not matter how, press ok, cancel or close "x")
- CRASH
Comment 34 Tobias N. 2013-12-29 23:09:38 UTC
I found a partial solution, which solves the problem, that simply selecting an encrypted message causes a crash:

Change the line in messageviewer/viewer/viewer_p.cpp:2097:
- mUpdateReaderWinTimer.start( 0 );
+ mUpdateReaderWinTimer.start( delay );

It is not a perfect solution, as the timeout may still be signalled while the mail-view is composed (if the processor is heavily loaded by other tasks, so that composing takes more time than <delay> milliseconds), but it should work in most cases.
Thus, I think it is a quick fix, that makes using decryption in KMail acceptable again.
Comment 35 Tobias N. 2014-01-31 20:21:59 UTC
Created attachment 84924 [details]
Patch to solve the bug entirely

The bug 96498 was very related to bug 279749 and has been fixed already.
However, it did not fix the problem entirely by avoiding simultaneous updates of a view.
E.g. when displaying an encrypted message, a dialog to enter the passphrase could be shown,
blocking the tree-parser.
Simultaneously, the user may select another message, making the node in the objecttreeparser
obsolete and invalid (thus causing a crash, when accessing the node's parent).
To solve this problem, all methods, that are processed after closing the dialog, must not
access the obsolete message node (done by setting mCancelTreeParsing=true).
Then, by updating the viewer, it is made sure, that the finally selected message is displayed.
Comment 36 Tobias N. 2014-01-31 22:50:54 UTC
Created attachment 84930 [details]
Patch to solve the bug entirely

Just reduced the patch to the relevant modifications.

While testing the patch, I found, that a minor problem occurs: The dialog to enter the passphrase for decryption is (sometimes) displayed twice. So instead of crashing, it looses the passphrase of the first dialog and has to show it again to parse the message.
Comment 37 Laurent Montel 2014-02-01 15:25:58 UTC
Another guy can confirm that this patch fixes problem ?
Comment 38 Albert Astals Cid 2014-02-01 16:01:42 UTC
I can try giving it a try next week.
Comment 39 Albert Astals Cid 2014-02-03 21:50:33 UTC
Actually i can't make the thing crash using the steps i described in step #8 anymore (even without the said patch) so can't confirm the patch is good or not since for me it's not needed.
Comment 40 Tobias N. 2014-02-04 19:19:00 UTC
Ok, may be the problem was already solved in another way, since I am using version 4.11.3 (Kubuntu). Comparing the sources of viewer_p.cpp with the latest version in git, however, does not show a bugfix for this problem.
May be I'll try and analyze the latest revision (or at least 4.12 - as there is an Ubuntu package available), when I have some more spare time in the next days.
Comment 41 Tobias N. 2014-02-08 09:26:47 UTC
I've now tried version 4.12.2 (ubuntu) and get the problem, that it is not possible at all to decrypt an email, that requires a passphrase for decryption. Thus the dialog does not appear and consequently, the problem cannot be reproduced anymore.
Let's hope this new issue gets fixed soon, so that my patch can be tested and the bug finally be fixed.

@Albert Astals Cid:
Did you experience the same problem and which version did you check?
Some feedback would be nice, as I am not 100% sure, wheter my test-system is set up properly.
Comment 42 Tobias N. 2014-02-14 20:47:40 UTC
I have tried version 4.11.5 and it is still reproducable.
Can anyone check this and/or commit the patch in the coming version 4.11.6?
Comment 43 Jekyll Wu 2014-03-31 01:32:42 UTC
*** Bug 332774 has been marked as a duplicate of this bug. ***
Comment 44 Tobias N. 2015-02-14 16:58:30 UTC
Hi,
at least with KDE 4.13 the problem seems to be fixed.
I cannot reproduce it, and the general behaviour regarding decryption has obviously been changed. So I assume, that there were major code changes and thus it cannot be reproduced with the more recent versions of KDE-PIM.

Regards,
 Tobias
Comment 45 Christoph Feck 2015-03-15 18:06:36 UTC
Thanks for the update, let's close it. Please add a comment, if you have more information.