mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 03:30:20 +00:00
Don't delete the documents in the converters, they are deleted
by the TextDocumentGenerator. svn path=/trunk/KDE/kdegraphics/okular/; revision=710348
This commit is contained in:
parent
08727a7cea
commit
cdcde2aeaf
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue