Don't leak memory

svn path=/trunk/playground/graphics/okular/; revision=622789
parent 26f4618a
......@@ -82,7 +82,7 @@ K_EXPORT_COMPONENT_FACTORY(libokularpart, okularPartFactory)
Part::Part(QWidget *parentWidget,
QObject *parent,
const QStringList & /*args*/ )
: KParts::ReadOnlyPart(parent),
: KParts::ReadOnlyPart(parent),
m_showMenuBarAction(0), m_showFullScreenAction(0), m_actionsSearched(false),
m_searchStarted(false), m_cliPresentation(false)
{
......@@ -92,7 +92,9 @@ Part::Part(QWidget *parentWidget,
connect(this, SIGNAL(started(KIO::Job *)), this, SLOT(setMimeTypes(KIO::Job *)));
// load catalog for translation
KGlobal::locale()->insertCatalog("okular");
m_tempfile= 0L;
// create browser extension (for printing when embedded into browser)
m_bExtension = new BrowserExtension(this);
......@@ -419,6 +421,9 @@ Part::~Part()
QHash<QString, Okular::Generator*>::iterator it = m_loadedGenerators.begin(), itEnd = m_loadedGenerators.end();
for ( ; it != itEnd; ++it )
delete *it;
if (m_tempfile)
delete m_tempfile;
}
bool Part::openDocument(const KUrl& url, uint page)
......@@ -1397,7 +1402,7 @@ bool Part::handleCompressed(KUrl & url, const QString &path, const KMimeType::Pt
// we are working with a compressed file, decompressing
// temporary file for decompressing
KTemporaryFile *m_tempfile = new KTemporaryFile;
m_tempfile = new KTemporaryFile;
if ( !m_tempfile )
{
KMessageBox::error( 0,
......
......@@ -40,6 +40,7 @@ class KToggleFullScreenAction;
class KSelectAction;
class KAboutData;
class KPrinter;
class KTemporaryFile;
class ThumbnailList;
class ThumbnailController;
......@@ -155,6 +156,7 @@ private:
void doPrint( KPrinter& printer );
void fillGenerators();
bool handleCompressed(KUrl & url, const QString &path, const KMimeType::Ptr mimetype);
KTemporaryFile *m_tempfile;
// the document
Okular::Document * m_document;
......
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