[umbrello-devel] [umbrello] [Bug 337606] Segmentation fault when opening a file that contains an "alternative" combined fragment

Oliver Kellogg okellogg at users.sourceforge.net
Sun Jul 20 06:22:58 UTC 2014


https://bugs.kde.org/show_bug.cgi?id=337606

Oliver Kellogg <okellogg at users.sourceforge.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
      Latest Commit|                            |http://commits.kde.org/umbr
                   |                            |ello/01e684f18108a7a8067166
                   |                            |9b63ddc4b09e087e9f

--- Comment #3 from Oliver Kellogg <okellogg at users.sourceforge.net> ---
Git commit 01e684f18108a7a80671669b63ddc4b09e087e9f by Oliver Kellogg.
Committed on 20/07/2014 at 06:23.
Pushed by okellogg into branch 'master'.

(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.

M  +6    -1    umbrello/umlscene.cpp
M  +2    -1    umbrello/widgets/combinedfragmentwidget.cpp

http://commits.kde.org/umbrello/01e684f18108a7a80671669b63ddc4b09e087e9f

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the umbrello-devel mailing list