From e58ee43ecc4fd031570b4978f92022ca8468cc9c Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt <lasse.holmstedt@nokia.com> Date: Tue, 2 Mar 2010 16:51:05 +0100 Subject: [PATCH] Fixed crash on deleting an item while resize tool is being hovered Task-number: BAUHAUS-425 Reviewed-by: marco --- .../qmldesigner/components/formeditor/resizecontroller.cpp | 2 +- .../qmldesigner/components/formeditor/resizecontroller.h | 2 +- src/plugins/qmldesigner/components/formeditor/resizetool.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp b/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp index 2281ff2e23f..439976913b7 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp +++ b/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp @@ -221,7 +221,7 @@ void ResizeController::updatePosition() FormEditorItem* ResizeController::formEditorItem() const { - return m_data->formEditorItem; + return m_data->formEditorItem.data(); } QWeakPointer<ResizeControllerData> ResizeController::weakPointer() const diff --git a/src/plugins/qmldesigner/components/formeditor/resizecontroller.h b/src/plugins/qmldesigner/components/formeditor/resizecontroller.h index be1e44824a8..0e4dfeaa827 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizecontroller.h +++ b/src/plugins/qmldesigner/components/formeditor/resizecontroller.h @@ -51,7 +51,7 @@ public: QWeakPointer<LayerItem> layerItem; - FormEditorItem *formEditorItem; + QWeakPointer<FormEditorItem> formEditorItem; ResizeHandleItem *topLeftItem; ResizeHandleItem *topRightItem; ResizeHandleItem *bottomLeftItem; diff --git a/src/plugins/qmldesigner/components/formeditor/resizetool.cpp b/src/plugins/qmldesigner/components/formeditor/resizetool.cpp index 397080881fc..289c5c748ed 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizetool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/resizetool.cpp @@ -62,7 +62,7 @@ void ResizeTool::mousePressEvent(const QList<QGraphicsItem*> &itemList, return; ResizeHandleItem *resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.first()); - if (resizeHandle) { + if (resizeHandle && resizeHandle->resizeController().isValid()) { m_resizeManipulator.setHandle(resizeHandle); m_resizeManipulator.begin(event->scenePos()); m_resizeIndicator.hide(); @@ -92,7 +92,7 @@ void ResizeTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList, if (itemList.isEmpty()) return; ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.first()); - if (resizeHandle) { + if (resizeHandle && resizeHandle->resizeController().isValid()) { m_resizeManipulator.setHandle(resizeHandle); } else { view()->changeToSelectionTool(); -- GitLab