okular/core/pagecontroller.cpp
Albert Astals Cid 662fa69a2d Fix crash on rotation jobs
We don't need to delete the threadweaver job, threadweaver does it by itself,
and if we call deleteLater it may happen that the main thread deletes it
and then when the threadweaver thread tries to call the delete things are
gone and it goes kaboom

BUGS: 382725
2017-11-02 17:49:08 +01:00

49 lines
1.4 KiB
C++

/***************************************************************************
* Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "pagecontroller_p.h"
// local includes
#include "page_p.h"
#include "rotationjob_p.h"
#include <threadweaver/queueing.h>
using namespace Okular;
PageController::PageController()
: QObject()
{
}
PageController::~PageController()
{
}
void PageController::addRotationJob(RotationJob *job)
{
connect( job, SIGNAL(done(ThreadWeaver::JobPointer)),
this, SLOT(imageRotationDone(ThreadWeaver::JobPointer)) );
ThreadWeaver::enqueue(&m_weaver, job);
}
void PageController::imageRotationDone(const ThreadWeaver::JobPointer &j)
{
RotationJob *job = static_cast< RotationJob * >( j.data() );
if ( job->page() )
{
job->page()->imageRotationDone( job );
emit rotationFinished( job->page()->m_number, job->page()->m_page );
}
}
#include "moc_pagecontroller_p.cpp"