Skip to content
Permalink
Browse files

Fix double ownership issue causing crash when deleting layouts

  • Loading branch information
nyalldawson committed Oct 21, 2017
1 parent 753f6f5 commit 6f59965ae1e4992a0e8333b066cff53f4df4006c
Showing with 10 additions and 10 deletions.
  1. +8 −8 src/gui/layout/qgslayoutmousehandles.cpp
  2. +2 −2 src/gui/layout/qgslayoutmousehandles.h
@@ -44,12 +44,12 @@ QgsLayoutMouseHandles::QgsLayoutMouseHandles( QgsLayout *layout, QgsLayoutView *
//accept hover events, required for changing cursor to resize cursors
setAcceptHoverEvents( true );

mHorizontalSnapLine.reset( mView->createSnapLine() );
mHorizontalSnapLine = mView->createSnapLine();
mHorizontalSnapLine->hide();
layout->addItem( mHorizontalSnapLine.get() );
mVerticalSnapLine.reset( mView->createSnapLine() );
layout->addItem( mHorizontalSnapLine );
mVerticalSnapLine = mView->createSnapLine();
mVerticalSnapLine->hide();
layout->addItem( mVerticalSnapLine.get() );
layout->addItem( mVerticalSnapLine );
}

void QgsLayoutMouseHandles::paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
@@ -722,12 +722,12 @@ QPointF QgsLayoutMouseHandles::snapPoint( QPointF originalPoint, QgsLayoutMouseH
switch ( mode )
{
case Item:
snappedPoint = mLayout->snapper().snapRect( rect().translated( originalPoint ), mView->transform().m11(), snapped, snapHorizontal ? mHorizontalSnapLine.get() : nullptr,
snapVertical ? mVerticalSnapLine.get() : nullptr, &itemsToExclude ).topLeft();
snappedPoint = mLayout->snapper().snapRect( rect().translated( originalPoint ), mView->transform().m11(), snapped, snapHorizontal ? mHorizontalSnapLine : nullptr,
snapVertical ? mVerticalSnapLine : nullptr, &itemsToExclude ).topLeft();
break;
case Point:
snappedPoint = mLayout->snapper().snapPoint( originalPoint, mView->transform().m11(), snapped, snapHorizontal ? mHorizontalSnapLine.get() : nullptr,
snapVertical ? mVerticalSnapLine.get() : nullptr, &itemsToExclude );
snappedPoint = mLayout->snapper().snapPoint( originalPoint, mView->transform().m11(), snapped, snapHorizontal ? mHorizontalSnapLine : nullptr,
snapVertical ? mVerticalSnapLine : nullptr, &itemsToExclude );
break;
}

@@ -159,8 +159,8 @@ class GUI_EXPORT QgsLayoutMouseHandles: public QObject, public QGraphicsRectItem
bool mIsResizing = false;

//! Align snap lines
std::unique_ptr< QGraphicsLineItem > mHorizontalSnapLine;
std::unique_ptr< QGraphicsLineItem > mVerticalSnapLine;
QGraphicsLineItem *mHorizontalSnapLine = nullptr;
QGraphicsLineItem *mVerticalSnapLine = nullptr;

QSizeF mCursorOffset;

0 comments on commit 6f59965

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