Bug#326592: more information
I just retrieved and compiled kmail and tried to reproduce the bug - it was
pretty easy, the behaviour is the same. I finally found out that the dialog
asking for a passphrase is simply not as modal as it should be.
For the record, the call in libkpgp/kpgp.cpp is
PassphraseDialog passdlg(0, i18n("OpenPGP Security Check"), true, ID);
QApplication::setOverrideCursor( QCursor(QCursor::ArrowCursor) );
int passdlgResult = passdlg.exec();
and instead of being modal (third parameter to ctor, also implied by calling
exec()) it allows further processing. The PassphraseDialog is basically
KDialogBase object with a few added widgets. What then happens is more or
less a recursive call to one of the longer-lasting objects and when the
dialog finally returns it finds that some parts it depended on were changed.
In other words it gets its data pulled from under its feet.
I can't tell whether that really is the case, but I strongly suspect that
QDialog's modality is somehow broken. I can read Qt/KDE programs but I'm not
really up to writing them, but I'd hope that someone that uses either of
these should be able to quickly hack together a project that would show where
the error lies.