Skip to content
Permalink
Browse files

More cleanup changes

  • Loading branch information
mhugent committed Aug 8, 2012
1 parent ce84b56 commit 852c5e78c28eb8dc3541e389e5fdbbaeeccac5d7
@@ -27,13 +27,7 @@ QgsComposerMultiFrame::QgsComposerMultiFrame(): mComposition( 0 ), mResizeMode(

QgsComposerMultiFrame::~QgsComposerMultiFrame()
{
setResizeMode( UseExistingFrames );
QList<QgsComposerFrame*>::iterator frameIt = mFrameItems.begin();
for ( ; frameIt != mFrameItems.end(); ++frameIt )
{
mComposition->removeComposerItem( *frameIt );
delete( *frameIt );
}
deleteFrames();
}

void QgsComposerMultiFrame::setResizeMode( ResizeMode mode )
@@ -152,12 +146,14 @@ void QgsComposerMultiFrame::deleteFrames()
{
ResizeMode bkResizeMode = mResizeMode;
mResizeMode = UseExistingFrames;
mComposition->blockSignals( true );
QList<QgsComposerFrame*>::iterator frameIt = mFrameItems.begin();
for ( ; frameIt != mFrameItems.end(); ++frameIt )
{
mComposition->removeComposerItem( *frameIt, false );
delete *frameIt;
}
mComposition->blockSignals( false );
mFrameItems.clear();
mResizeMode = bkResizeMode;
}
@@ -60,6 +60,14 @@ QgsComposition::QgsComposition():
QgsComposition::~QgsComposition()
{
removePaperItems();

QSet<QgsComposerMultiFrame*>::iterator multiFrameIt = mMultiFrames.begin();
for ( ; multiFrameIt != mMultiFrames.end(); ++multiFrameIt )
{
delete *multiFrameIt;
}
mMultiFrames.clear();

// make sure that all composer items are removed before
// this class is deconstructed - to avoid segfaults
// when composer items access in destructor composition that isn't valid anymore
@@ -206,6 +206,7 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
void beginMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text );
void endMultiFrameCommand();

/**Adds multiframe. The object is owned by QgsComposition until removeMultiFrame is called*/
void addMultiFrame( QgsComposerMultiFrame* multiFrame );
/**Removes multi frame (but does not delete it)*/
void removeMultiFrame( QgsComposerMultiFrame* multiFrame );
@@ -67,7 +67,7 @@ void TestQgsComposerHtml::table()
"control_images" + QDir::separator() + "expected_composerhtml" + QDir::separator() + "composerhtml_table.png" ) );
bool result = checker.testComposition();
mComposition->removeMultiFrame( htmlItem );
//delete htmlItem;
delete htmlItem;
QVERIFY( result );
}

@@ -102,6 +102,7 @@ void TestQgsComposerHtml::tableMultiFrame()
}

mComposition->removeMultiFrame( htmlItem );
delete htmlItem;
QVERIFY( result );
}

0 comments on commit 852c5e7

Please sign in to comment.
You can’t perform that action at this time.