mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-19 07:51:27 +00:00
77daa9627b
Cherry-picked from a556126816
The patch de-singletons the PageController class.
The PageController is now per-document and it gets deleted when the
document is closed.
As consequence of this, the RotationJob's done signal will not be
delivered if the document has been closed, and thus this fixes the
crash.
53 lines
1.4 KiB
C++
53 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"
|
|
|
|
// qt/kde includes
|
|
#include <kglobal.h>
|
|
#include <threadweaver/ThreadWeaver.h>
|
|
|
|
// local includes
|
|
#include "page_p.h"
|
|
#include "rotationjob_p.h"
|
|
|
|
using namespace Okular;
|
|
|
|
PageController::PageController()
|
|
: QObject()
|
|
{
|
|
}
|
|
|
|
PageController::~PageController()
|
|
{
|
|
}
|
|
|
|
void PageController::addRotationJob(RotationJob *job)
|
|
{
|
|
connect( job, SIGNAL(done(ThreadWeaver::Job*)),
|
|
this, SLOT(imageRotationDone(ThreadWeaver::Job*)) );
|
|
ThreadWeaver::Weaver::instance()->enqueue(job);
|
|
}
|
|
|
|
void PageController::imageRotationDone(ThreadWeaver::Job *j)
|
|
{
|
|
RotationJob *job = static_cast< RotationJob * >( j );
|
|
|
|
if ( job->page() )
|
|
{
|
|
job->page()->imageRotationDone( job );
|
|
|
|
emit rotationFinished( job->page()->m_number, job->page()->m_page );
|
|
}
|
|
|
|
job->deleteLater();
|
|
}
|
|
|
|
#include "pagecontroller_p.moc"
|