Commit 972f7145 authored by Ralf Habacker's avatar Ralf Habacker

Fix 'Crash on removing diagram'.

Using pointer to widget when it is not found within the document.

CCBUG:352633
BUG:358286
FIXED-IN:2.18.2 (KDE Applications 15.12.2)
parent 7fc95d9b
......@@ -36,7 +36,9 @@ namespace Uml
{
Q_ASSERT(widget);
m_widget = widget;
m_widgetId = widget->localID();
m_scene = widget->umlScene();
m_sceneId = widget->umlScene()->ID();
}
......@@ -44,18 +46,22 @@ namespace Uml
{
UMLView* umlView = UMLApp::app()->document()->findView(m_sceneId);
Q_ASSERT(umlView);
if (umlView)
return umlView->umlScene();
return umlView->umlScene();
Q_ASSERT(m_scene.data());
return m_scene;
}
UMLWidget* CmdBaseWidgetCommand::widget()
{
UMLWidget* umlWidget = scene()->findWidget(m_widgetId);
Q_ASSERT(umlWidget);
if (umlWidget)
return umlWidget;
return umlWidget;
Q_ASSERT(m_widget.data());
return m_widget;
}
/**
......
......@@ -13,6 +13,7 @@
#include "basictypes.h"
#include <QPointer>
#include <QUndoCommand>
class UMLScene;
......@@ -29,6 +30,8 @@ namespace Uml
protected:
Uml::ID::Type m_sceneId;
Uml::ID::Type m_widgetId;
QPointer<UMLScene> m_scene;
QPointer<UMLWidget> m_widget;
void setWidget(UMLWidget* widget);
void addWidgetToScene(UMLWidget* widget);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment