From 6016cf593647eeca34ab486433426c2cc5aa743f Mon Sep 17 00:00:00 2001 From: Pradeepto Bhattacharya Date: Thu, 24 May 2007 15:54:53 +0000 Subject: [PATCH] Merge ... SVN commit 645446 by wstephens: Disallow closing the composer window whilst performing a sign operation, this causes a crash when using the non-gpg-agent PGP backend. BUG#113580 svn path=/branches/kdepim/enterprise/kdepim/; revision=667962 --- kmcomposewin.cpp | 2 ++ messagecomposer.cpp | 7 ++++--- messagecomposer.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/kmcomposewin.cpp b/kmcomposewin.cpp index fa481a70f..0d9dfe5b6 100644 --- a/kmcomposewin.cpp +++ b/kmcomposewin.cpp @@ -2062,6 +2062,8 @@ bool KMComposeWin::queryClose () return false; if ( kmkernel->shuttingDown() || kapp->sessionSaving() ) return true; + if ( mComposer && mComposer->isPerformingSignOperation() ) // since the non-gpg-agent gpg plugin gets a passphrase using QDialog::exec() + return false; // the user can try to close the window, which destroys mComposer mid-call. if ( isModified() ) { bool istemplate = ( mFolder!=0 && mFolder->isTemplates() ); diff --git a/messagecomposer.cpp b/messagecomposer.cpp index 037f95d56..66c42b458 100644 --- a/messagecomposer.cpp +++ b/messagecomposer.cpp @@ -287,7 +287,7 @@ public: MessageComposer::MessageComposer( KMComposeWin* win, const char* name ) : QObject( win, name ), mComposeWin( win ), mCurrentJob( 0 ), - mKeyResolver( 0 ), mIdentityUid( 0 ) + mKeyResolver( 0 ), mIdentityUid( 0 ), mPerformingSignOperation( false ) { } @@ -1590,9 +1590,10 @@ void MessageComposer::composeMessage( KMMessage& theMessage, } if ( doSignBody ) { - + mPerformingSignOperation = true; // this lets the KMComposeWin know if it is safe to close the window. pgpSignedMsg( mEncodedBody, format ); - + mPerformingSignOperation = false; + if ( mSignature.isEmpty() ) { kdDebug() << "signature was empty" << endl; mRc = false; diff --git a/messagecomposer.h b/messagecomposer.h index ac7633665..00cd0b9d6 100644 --- a/messagecomposer.h +++ b/messagecomposer.h @@ -92,6 +92,7 @@ public: return mMessageList; } + bool isPerformingSignOperation() const { return mPerformingSignOperation; } signals: void done( bool ); @@ -273,6 +274,7 @@ private: QValueList mJobs; bool mEncryptWithChiasmus; + bool mPerformingSignOperation; }; #endif /* MESSAGECOMPOSER_H */