[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    [PATCH] Workaround for bug 56693 (kmail freeze with the complete
From:       Ingo =?iso-8859-15?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2003-11-14 23:01:40
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Hi,

the reason for this freeze is a dead lock between the context popup menu 
and the pinentry program. Both grab the keyboard and this results in 
the freeze of the whole desktop. IMO this isn't a bug in KMail but a 
bug in the X server. It should prevent such a dead lock. Anyway, the 
attached patch works around this bug by aborting decryption in case the 
folder context menu or the message list context menu is shown.

Possible (future) improvements:
- Only abort decryption in case gpg needs to ask for the passphrase. I 
don't know whether it's possible to check for this though.
- Better error message. The problem is that we shouldn't go into detail 
here. OTOH we might receive bug reports because some users might think 
they've discovered a bug. So maybe we can improve the message so that 
the users don't get this impression.
- Add an internal KMail link a la "Click here to decrypt the 
message." (similar to the "Click here to show message as HTML").

As you can see this patch introduces two new strings. But without those 
strings fixing this major bug (I'd even say it's a grave bug, after all 
it freezes the whole system and the normal user won't know better than 
to hard reset his computer) isn't possible.

This leads to the following question: Now that the release has been 
delayed for six weeks do we have to beg for permission for each string 
change which is necessary in order to fix a major+ bug? Yes, we must 
keep the changes to a minimum but don't you think that fixing major 
bugs is much more important than a 100% translated application.

Regards,
Ingo

["workaround_keyboard_grabbing_deadlock.diff" (text/x-diff)]

Index: kmfoldertree.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmfoldertree.cpp,v
retrieving revision 1.269
diff -u -3 -p -r1.269 kmfoldertree.cpp
--- kmfoldertree.cpp	30 Oct 2003 17:17:58 -0000	1.269
+++ kmfoldertree.cpp	14 Nov 2003 22:29:28 -0000
@@ -1052,9 +1052,12 @@ void KMFolderTree::rightButtonPressed(QL
   }
 
 
+  kmkernel->setContextMenuShown( true );
   folderMenu->exec (p, 0);
+  kmkernel->setContextMenuShown( false );
   triggerUpdate();
   delete folderMenu;
+  folderMenu = 0;
 }
 
 //-----------------------------------------------------------------------------
Index: kmheaders.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmheaders.cpp,v
retrieving revision 1.588
diff -u -3 -p -r1.588 kmheaders.cpp
--- kmheaders.cpp	12 Nov 2003 21:19:38 -0000	1.588
+++ kmheaders.cpp	14 Nov 2003 22:29:29 -0000
@@ -2465,7 +2465,9 @@ void KMHeaders::slotRMB()
 
   mOwner->action("apply_filter_actions")->plug(menu);
 
+  kmkernel->setContextMenuShown( true );
   menu->exec (QCursor::pos(), 0);
+  kmkernel->setContextMenuShown( false );
   delete menu;
 }
 
Index: kmkernel.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmkernel.cpp,v
retrieving revision 1.220
diff -u -3 -p -r1.220 kmkernel.cpp
--- kmkernel.cpp	10 Nov 2003 19:25:50 -0000	1.220
+++ kmkernel.cpp	14 Nov 2003 22:29:30 -0000
@@ -73,7 +73,8 @@ KMKernel *KMKernel::mySelf = 0;
 /********************************************************************/
 KMKernel::KMKernel (QObject *parent, const char *name) :
   DCOPObject("KMailIface"), QObject(parent, name),
-  mIdentityManager(0), mProgress(0), mConfigureDialog(0)
+  mIdentityManager(0), mProgress(0), mConfigureDialog(0),
+  mContextMenuShown( false )
 {
   //kdDebug(5006) << "KMKernel::KMKernel" << endl;
   mySelf = this;
Index: kmkernel.h
===================================================================
RCS file: /home/kde/kdepim/kmail/kmkernel.h,v
retrieving revision 1.84
diff -u -3 -p -r1.84 kmkernel.h
--- kmkernel.h	6 Nov 2003 09:25:56 -0000	1.84
+++ kmkernel.h	14 Nov 2003 22:29:30 -0000
@@ -199,6 +199,9 @@ public:
   /** returns the currently active message window */
   KMReaderWin* activeReaderWin();
 
+  void setContextMenuShown( bool flag ) { mContextMenuShown = flag; }
+  bool contextMenuShown() const { return mContextMenuShown; }
+
 public slots:
   //Save contents of all open composer widnows to ~/dead.letter
   void dumpDeadLetters();
@@ -303,6 +306,11 @@ private:
   KMMainWin *mWin;
   MailServiceImpl *mMailService;
 
+  // true if the context menu of KMFolderTree or KMHeaders is shown
+  // this is necessary to know in order to prevent a dead lock between the
+  // context menus and the pinentry program
+  bool mContextMenuShown;
+
   /* Weaver */
   KPIM::ThreadWeaver::Weaver *the_weaver;
   KPIM::ThreadWeaver::WeaverThreadLogger *the_weaverLogger;
Index: objecttreeparser.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/objecttreeparser.cpp,v
retrieving revision 1.88
diff -u -3 -p -r1.88 objecttreeparser.cpp
--- objecttreeparser.cpp	28 Oct 2003 19:28:46 -0000	1.88
+++ objecttreeparser.cpp	14 Nov 2003 22:29:33 -0000
@@ -646,7 +649,7 @@ bool ObjectTreeParser::okDecryptMIME( pa
     }
   }
 
-  if ( cryptPlug ) {
+  if ( cryptPlug && !kmkernel->contextMenuShown() ) {
     QByteArray ciphertext( data.msgPart().bodyDecodedBinary() );
     QCString cipherStr( ciphertext.data(), ciphertext.size() + 1 );
     bool cipherIsBinary = (-1 == cipherStr.find("BEGIN ENCRYPTED MESSAGE", 0, false) ) &&
@@ -707,7 +710,7 @@ bool ObjectTreeParser::okDecryptMIME( pa
     delete errTxt;
     delete[] cleartext;
   }
-  else {
+  else if ( !cryptPlug ) {
     decryptedData = "<div style=\"text-align:center; padding:20pt;\">"
                   + i18n("Undecryptable data not shown.").utf8()
                   + "</div>";
@@ -725,6 +728,13 @@ bool ObjectTreeParser::okDecryptMIME( pa
       break;
     }
   }
+  else {
+    // FIXME i18n this after the string freeze
+    decryptedData = "<div style=\"text-align:center; padding:20pt;\">"
+                   "Undecrypted data not shown." // i18n( ... ).utf8() !!!
+                   "</div>";
+    aErrorText = "Decryption aborted. Please retry.";
+  }
 
   dumpToFile( "dat_05_reader.decrypted", decryptedData.data(), decryptedData.size() );
 

[Attachment #8 (application/pgp-signature)]

_______________________________________________
KMail Developers mailing list
kmail@kde.org
https://mail.kde.org/mailman/listinfo/kmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic