Skip to content
Commit 01e684f1 authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

(In reply to Philipp Harms from comment #2)

> [...]
> The problem seems to be calling the UMLScene::setupNewWidget(...) method
> to add the dashed line of the alternative to the viewer. It sets up a
> CmdCreateWidget object that is meant for being placed on the stack of
> undoable actions. The segfault finally occurs when this object looks in
> the global UMLDoc for the UMLView that is currently being constructed
> (which fails and returns an invalid pointer).
>
> Can somebody confirm my interpretation, please?

Yes, that's right.  At the time of loading the widget from XMI, the view
has not yet been added to the document (UMLDoc.) Therefore, the call to
CmdBaseWidgetCommand::scene() from CmdBaseWidgetCommand::addWidgetToScene()
fails at Q_ASSERT(umlView).
Thanks for your analysis and patch.

umbrello/widgets/combinedfragmentwidget.cpp
- In function loadFromXMI(), avoid calling m_scene->setupNewWidget() after
  fdlwidget->loadFromXMI(). Reason: In UMLScene::setupNewWidget(),
    UMLApp::app()->executeCommand(new CmdCreateWidget(w))
  leads to call of
    CmdBaseWidgetCommand::addWidgetToScene()
  and then
    CmdBaseWidgetCommand::scene()
  but this call fails during load at Q_ASSERT(umlView).

umbrello/umlscene.cpp
- In function setupNewWidget(), do not call
    UMLApp::app()->executeCommand(new CmdCreateWidget(w));
  when m_doc->loading() returns true.
  Instead, call m_WidgetList.append(w) directly.
  This should prevent crashes in similar situations as the one above.

BUG:337606
parent bbfe1005
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