Apply "Fix: crashing when {un,re}do commands"
https://mail.kde.org/pipermail/umbrello-devel/2022-April/023234.html Executing {un,re}do commands a sigsegv happens as follows: > [...] > at > /umbrello_git/umbrello/cmds/widget/cmdbasewidgetcommand.cpp:77 > (this=0x7fffe4006f10) > at > /umbrello_git/umbrello/cmds/widget/cmdcreatewidget.cpp:124 When `undo' command is triggered, it calls to `o->deleteLater' getting out of memory the `widget' object, then, doing a `redo' command this object is not longer available, so an invalid `m_widget' reference is used. This patch change this behavior calling `{add,remove}Item' member function from `{re,un}do' callbacks respectively triggered by `QUndoStack::push' member. umbrello/cmds/widget/cmdcreatewidget.cpp - Move call to addWidgetToScene from constructor to function redo(). - In function redo() use `addWidgetToScene' with `m_widget', updating scene object. umbrello/umlscene.cpp - In function removeWidgetCmd() remove `o->deleteLater' updating the scene. Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
parent
257f0919
Please register or sign in to comment