Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix crash when exporting layout
Fixes #29798
  • Loading branch information
elpaso authored and nyalldawson committed May 30, 2019
1 parent c4dfd98 commit cd768a7
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/core/layout/qgslayoutmultiframe.cpp
Expand Up @@ -385,20 +385,23 @@ void QgsLayoutMultiFrame::handlePageChange()
}
}

//page number of the last item
QgsLayoutFrame *lastFrame = mFrameItems.last();
int lastItemPage = mLayout->pageCollection()->predictPageNumberForPoint( lastFrame->pos() );

for ( int i = lastItemPage + 1; i < mLayout->pageCollection()->pageCount(); ++i )
if ( mFrameItems.count( ) )
{
//copy last frame to current page
std::unique_ptr< QgsLayoutFrame > newFrame = qgis::make_unique< QgsLayoutFrame >( mLayout, this );

newFrame->attemptSetSceneRect( QRectF( lastFrame->pos().x(),
mLayout->pageCollection()->page( i )->pos().y() + lastFrame->pagePos().y(),
lastFrame->rect().width(), lastFrame->rect().height() ) );
lastFrame = newFrame.get();
addFrame( newFrame.release(), false );
//page number of the last item
QgsLayoutFrame *lastFrame = mFrameItems.last();
int lastItemPage = mLayout->pageCollection()->predictPageNumberForPoint( lastFrame->pos() );

for ( int i = lastItemPage + 1; i < mLayout->pageCollection()->pageCount(); ++i )
{
//copy last frame to current page
std::unique_ptr< QgsLayoutFrame > newFrame = qgis::make_unique< QgsLayoutFrame >( mLayout, this );

newFrame->attemptSetSceneRect( QRectF( lastFrame->pos().x(),
mLayout->pageCollection()->page( i )->pos().y() + lastFrame->pagePos().y(),
lastFrame->rect().width(), lastFrame->rect().height() ) );
lastFrame = newFrame.get();
addFrame( newFrame.release(), false );
}
}

recalculateFrameSizes();
Expand Down

0 comments on commit cd768a7

Please sign in to comment.