Don't leak memory

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