Skip to content
Permalink
Browse files

Fix crash when reopening existing layouts

  • Loading branch information
nyalldawson committed Dec 5, 2017
1 parent b6dab6f commit ac6c1312123b6b1a7cc09b3f58988ceea889de78
@@ -25,6 +25,7 @@ class QgsLayoutViewToolSelect : QgsLayoutViewTool
%Docstring
Constructor for QgsLayoutViewToolSelect.
%End
~QgsLayoutViewToolSelect();

virtual void layoutPressEvent( QgsLayoutViewMouseEvent *event );

@@ -617,6 +617,7 @@ QgsLayout *QgsLayoutDesignerDialog::currentLayout()

void QgsLayoutDesignerDialog::setCurrentLayout( QgsLayout *layout )
{
layout->deselectAll();
mLayout = layout;
connect( mLayout, &QgsLayout::destroyed, this, &QgsLayoutDesignerDialog::close );

@@ -311,6 +311,9 @@ bool QgsLayoutMouseHandles::selectionRotation( double &rotation ) const

double QgsLayoutMouseHandles::rectHandlerBorderTolerance()
{
if ( !mView )
return 0;

//calculate size for resize handles
//get view scale factor
double viewScaleFactor = mView->transform().m11();
@@ -30,6 +30,12 @@ QgsLayoutViewToolSelect::QgsLayoutViewToolSelect( QgsLayoutView *view )
mRubberBand->setPen( QPen( QBrush( QColor( 254, 58, 29, 100 ) ), 0, Qt::DotLine ) );
}

QgsLayoutViewToolSelect::~QgsLayoutViewToolSelect()
{
if ( mMouseHandles )
mMouseHandles->deleteLater();
}

void QgsLayoutViewToolSelect::layoutPressEvent( QgsLayoutViewMouseEvent *event )
{
if ( mMouseHandles->shouldBlockEvent( event ) )
@@ -276,6 +282,7 @@ QgsLayoutMouseHandles *QgsLayoutViewToolSelect::mouseHandles()
void QgsLayoutViewToolSelect::setLayout( QgsLayout *layout )
{
// existing handles are owned by previous layout
mMouseHandles->deleteLater();

//add mouse selection handles to layout, and initially hide
mMouseHandles = new QgsLayoutMouseHandles( layout, view() );
@@ -40,6 +40,7 @@ class GUI_EXPORT QgsLayoutViewToolSelect : public QgsLayoutViewTool
* Constructor for QgsLayoutViewToolSelect.
*/
QgsLayoutViewToolSelect( QgsLayoutView *view SIP_TRANSFERTHIS );
~QgsLayoutViewToolSelect();

void layoutPressEvent( QgsLayoutViewMouseEvent *event ) override;
void layoutMoveEvent( QgsLayoutViewMouseEvent *event ) override;

0 comments on commit ac6c131

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