Commit e96246c4 authored by Thomas Zander's avatar Thomas Zander

Fix possible crash when deleting the action before the job is finished.

svn path=/trunk/koffice/; revision=689824
parent 65ac3688
......@@ -42,7 +42,11 @@ ActionJob::ActionJob(KoAction *parent, Enable enable, const QVariant &params)
void ActionJob::run() {
m_started = true;
if(m_action.isNull())
return;
m_action->doAction(m_params);
if(m_action.isNull())
return;
switch(m_enable) {
case EnableOn:
m_action->setEnabled(true);
......@@ -67,7 +71,8 @@ void ActionJob::run() {
bool ActionJob::event(QEvent *e) {
ActionJobEvent *event = dynamic_cast<ActionJobEvent*> (e);
if(event) {
m_action->doActionUi(m_params);
if(! m_action.isNull())
m_action->doActionUi(m_params);
m_mutex.lock(); // wait for the above to start waiting on us.
m_waiter.wakeAll();
m_mutex.unlock();
......
/*
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
......@@ -24,6 +23,7 @@
#include <QWaitCondition>
#include <QMutex>
#include <QVariant>
#include <QPointer>
class QEvent;
......@@ -49,7 +49,7 @@ private:
bool event(QEvent *e);
private:
KoAction *m_action;
QPointer<KoAction> m_action;
Enable m_enable;
bool m_started;
QVariant m_params;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment