From 083e423de20062b330ec613e667a51af9c70b891 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Fri, 2 May 2008 16:21:15 +0000 Subject: [PATCH] start() apparently doesn't emit result() if it returns an error immediately, so don't enter the event loop in that case. svn path=/trunk/KDE/kdepim/; revision=803343 --- kleojobexecutor.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/kleojobexecutor.cpp b/kleojobexecutor.cpp index b6a1664f7..5c374ac53 100644 --- a/kleojobexecutor.cpp +++ b/kleojobexecutor.cpp @@ -48,7 +48,9 @@ GpgME::VerificationResult KleoJobExecutor::exec( kDebug() << "Starting detached verification job"; connect( job, SIGNAL(result(GpgME::VerificationResult)), SLOT(verificationResult(GpgME::VerificationResult)) ); - job->start( signature, signedData ); + GpgME::Error err = job->start( signature, signedData ); + if ( err ) + return VerificationResult( err ); mEventLoop->exec(); return mVerificationResult; } @@ -61,7 +63,11 @@ GpgME::VerificationResult KleoJobExecutor::exec( kDebug() << "Starting opaque verfication job"; connect( job, SIGNAL(result(GpgME::VerificationResult,QByteArray)), SLOT(verificationResult(GpgME::VerificationResult,QByteArray)) ); - job->start( signedData ); + GpgME::Error err = job->start( signedData ); + if ( err ) { + plainText.clear(); + return VerificationResult( err ); + } mEventLoop->exec(); plainText = mData; return mVerificationResult; @@ -75,7 +81,11 @@ std::pair< GpgME::DecryptionResult, GpgME::VerificationResult > KleoJobExecutor: kDebug() << "Starting decryption job"; connect( job, SIGNAL(result(GpgME::DecryptionResult,GpgME::VerificationResult,QByteArray)), SLOT(decryptResult(GpgME::DecryptionResult,GpgME::VerificationResult,QByteArray)) ); - job->start( cipherText ); + GpgME::Error err = job->start( cipherText ); + if ( err ) { + plainText.clear(); + return std::make_pair( DecryptionResult( err ), VerificationResult( err ) ); + } mEventLoop->exec(); plainText = mData; return std::make_pair( mDecryptResult, mVerificationResult ); @@ -84,7 +94,9 @@ std::pair< GpgME::DecryptionResult, GpgME::VerificationResult > KleoJobExecutor: GpgME::ImportResult KleoJobExecutor::exec(Kleo::ImportJob* job, const QByteArray & certData) { connect( job, SIGNAL(result(GpgME::ImportResult)), SLOT(importResult(GpgME::ImportResult)) ); - job->start( certData ); + GpgME::Error err = job->start( certData ); + if ( err ) + return ImportResult( err ); mEventLoop->exec(); return mImportResult; }