At least on OSX and Windows the job can't be accessed after the nested event loop returns, as the primary event loop will be entered from quit(), which processes delete events (from deleteLater()) which nukes the job. Cache the audit log in the executor to work around this. Scary problem, this is probably relied upon a lot, with KJobs all over the place.

svn path=/trunk/KDE/kdepim/; revision=812090
wilder-work
Till Adam 18 years ago
parent 3038fa367b
commit 2b7ee6fa74
  1. 20
      kleojobexecutor.cpp
  2. 3
      kleojobexecutor.h
  3. 5
      objecttreeparser.cpp

@ -28,6 +28,8 @@
#include <QBuffer>
#include <QEventLoop>
#include <cassert>
using namespace KMail;
using namespace Kleo;
using namespace GpgME;
@ -104,15 +106,21 @@ GpgME::ImportResult KleoJobExecutor::exec(Kleo::ImportJob* job, const QByteArray
void KleoJobExecutor::verificationResult(const GpgME::VerificationResult & result)
{
kDebug() << "Detached verification job finished";
Kleo::Job * job = dynamic_cast<Kleo::Job*>( sender() );
assert(job);
mVerificationResult = result;
mAuditLog = job->auditLogAsHtml();
mEventLoop->quit();
}
void KleoJobExecutor::verificationResult(const GpgME::VerificationResult & result, const QByteArray & plainText)
{
kDebug() << "Opaque verification job finished";
Kleo::Job * job = dynamic_cast<Kleo::Job*>( sender() );
assert(job);
mVerificationResult = result;
mData = plainText;
mAuditLog = job->auditLogAsHtml();
mEventLoop->quit();
}
@ -122,16 +130,28 @@ void KleoJobExecutor::decryptResult(
const QByteArray & plainText )
{
kDebug() << "Decryption job finished";
Kleo::Job * job = dynamic_cast<Kleo::Job*>( sender() );
assert(job);
mVerificationResult = verificationresult;
mDecryptResult = decryptionresult;
mData = plainText;
mAuditLog = job->auditLogAsHtml();
mEventLoop->quit();
}
void KleoJobExecutor::importResult(const GpgME::ImportResult & result)
{
Kleo::Job * job = dynamic_cast<Kleo::Job*>( sender() );
assert(job);
mImportResult = result;
mAuditLog = job->auditLogAsHtml();
mEventLoop->quit();
}
QString KleoJobExecutor::auditLogAsHtml() const
{
return mAuditLog;
}
#include "kleojobexecutor.moc"

@ -58,6 +58,8 @@ class KleoJobExecutor : public QObject
QByteArray &plainText );
GpgME::ImportResult exec( Kleo::ImportJob* job, const QByteArray &certData );
QString auditLogAsHtml() const;
private slots:
void verificationResult( const GpgME::VerificationResult &result );
void verificationResult( const GpgME::VerificationResult &result, const QByteArray &plainText );
@ -72,6 +74,7 @@ class KleoJobExecutor : public QObject
GpgME::DecryptionResult mDecryptResult;
GpgME::ImportResult mImportResult;
QByteArray mData;
QString mAuditLog;
};
}

@ -104,6 +104,7 @@ using KPIMUtils::LinkLocator;
#include <QBuffer>
#include <QPixmap>
#include <QPainter>
#include <QPointer>
// other headers
#include <sys/stat.h>
@ -449,7 +450,7 @@ namespace KMail {
if ( Kleo::VerifyDetachedJob * const job = cryptProto->verifyDetachedJob() ) {
KleoJobExecutor executor;
result = executor.exec( job, signaturetext, cleartext );
messagePart.auditLog = job->auditLogAsHtml();
messagePart.auditLog = executor.auditLogAsHtml();
} else {
cryptPlugError = CANT_VERIFY_SIGNATURES;
}
@ -457,7 +458,7 @@ namespace KMail {
if ( Kleo::VerifyOpaqueJob * const job = cryptProto->verifyOpaqueJob() ) {
KleoJobExecutor executor;
result = executor.exec( job, signaturetext, cleartext );
messagePart.auditLog = job->auditLogAsHtml();
messagePart.auditLog = executor.auditLogAsHtml();
} else {
cryptPlugError = CANT_VERIFY_SIGNATURES;
}

Loading…
Cancel
Save