From a169bbc5cfbc5ec1c5f993000c48ddb4667be755 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sat, 15 Mar 2008 11:02:24 +0000 Subject: [PATCH] do not leak the document when the loading fails svn path=/trunk/playground/graphics/okular/epub/; revision=785868 --- converter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/converter.cpp b/converter.cpp index 1a7ae2c83..884face01 100644 --- a/converter.cpp +++ b/converter.cpp @@ -103,11 +103,13 @@ void Converter::_handle_anchors(const QTextBlock &start, const QString &name) { QTextDocument* Converter::convert( const QString &fileName ) { - mTextDocument = new EpubDocument(fileName); - if (!mTextDocument->isValid()) { + EpubDocument *newDocument = new EpubDocument(fileName); + if (!newDocument->isValid()) { emit error(i18n("Error while opening the EPub document."), -1); + delete newDocument; return NULL; } + mTextDocument = newDocument; mTextDocument->setPageSize(QSizeF(600, 800));