Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cdcde2ae authored by Tobias Koenig's avatar Tobias Koenig

Don't delete the documents in the converters, they are deleted

by the TextDocumentGenerator.

svn path=/trunk/KDE/kdegraphics/okular/; revision=710348
parent 08727a7c
......@@ -70,9 +70,6 @@ QTextDocument* Converter::convert( const QString &fileName )
return false;
}
delete mTextDocument;
delete mCursor;
mTextDocument = new QTextDocument;
mCursor = new QTextCursor( mTextDocument );
mSectionCounter = 0;
......@@ -99,6 +96,7 @@ QTextDocument* Converter::convert( const QString &fileName )
if ( documentElement.tagName() != QLatin1String( "FictionBook" ) ) {
emit error( i18n( "Document is not a valid FictionBook" ), -1 );
delete mCursor;
return false;
}
......@@ -108,8 +106,10 @@ QTextDocument* Converter::convert( const QString &fileName )
QDomElement element = documentElement.firstChildElement();
while ( !element.isNull() ) {
if ( element.tagName() == QLatin1String( "binary" ) ) {
if ( !convertBinary( element ) )
if ( !convertBinary( element ) ) {
delete mCursor;
return false;
}
}
element = element.nextSiblingElement();
......@@ -121,8 +121,10 @@ QTextDocument* Converter::convert( const QString &fileName )
element = documentElement.firstChildElement();
while ( !element.isNull() ) {
if ( element.tagName() == QLatin1String( "description" ) ) {
if ( !convertDescription( element ) )
if ( !convertDescription( element ) ) {
delete mCursor;
return false;
}
} else if ( element.tagName() == QLatin1String( "body" ) ) {
if ( !mTitleInfo->mCoverPage.isNull() ) {
convertCover( mTitleInfo->mCoverPage );
......@@ -161,8 +163,10 @@ QTextDocument* Converter::convert( const QString &fileName )
mCursor->insertBlock();
if ( !convertBody( element ) )
if ( !convertBody( element ) ) {
delete mCursor;
return false;
}
}
element = element.nextSiblingElement();
......@@ -204,6 +208,8 @@ QTextDocument* Converter::convert( const QString &fileName )
emit addAction( action, it.value().first, it.value().second );
}
delete mCursor;
return mTextDocument;
}
......
......@@ -80,9 +80,6 @@ QTextDocument* Converter::convert( const QString &fileName )
return 0;
}
delete mTextDocument;
delete mCursor;
mTextDocument = new QTextDocument;
mCursor = new QTextCursor( mTextDocument );
......@@ -98,6 +95,7 @@ QTextDocument* Converter::convert( const QString &fileName )
QDomDocument document;
if ( !document.setContent( &source, &reader, &errorMsg ) ) {
emit error( i18n( "Invalid XML document: %1", errorMsg ), -1 );
delete mCursor;
return false;
}
......@@ -108,6 +106,7 @@ QTextDocument* Converter::convert( const QString &fileName )
StyleParser styleParser( &oooDocument, document, mStyleInformation );
if ( !styleParser.parse() ) {
emit error( i18n( "Unable to read style information" ), -1 );
delete mCursor;
return false;
}
......@@ -145,6 +144,7 @@ QTextDocument* Converter::convert( const QString &fileName )
if ( element.tagName() == QLatin1String( "body" ) ) {
if ( !convertBody( element ) ) {
emit error( i18n( "Unable to convert document content" ), -1 );
delete mCursor;
return false;
}
}
......@@ -159,6 +159,8 @@ QTextDocument* Converter::convert( const QString &fileName )
metaInformation[ i ].title() );
}
delete mCursor;
return mTextDocument;
}
......
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