Don't leak memory

svn path=/trunk/playground/graphics/okular/; revision=622789
This commit is contained in:
Leandro Emanuel López 2007-01-13 00:18:44 +00:00
parent 26f4618ae3
commit 21c42d89c7
2 changed files with 10 additions and 3 deletions

View file

@ -93,6 +93,8 @@ Part::Part(QWidget *parentWidget,
// 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,

2
part.h
View file

@ -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;