diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 8234a02f..a9cba8a8 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -387,14 +387,19 @@ void UBGraphicsItemDelegate::remove(bool canUndo) scene->removeItem(button); scene->removeItem(mFrame); + + /* this is performed because when removing delegated from scene while it contains flash content, segfault happens because of QGraphicsScene::removeItem() */ + UBGraphicsWebView *mDelegated_casted = static_cast(mDelegated); + if (mDelegated_casted) + mDelegated_casted->setHtml(QString()); scene->removeItem(mDelegated); if (canUndo) { - UBGraphicsItemUndoCommand *uc = new UBGraphicsItemUndoCommand((UBGraphicsScene*) scene, mDelegated, 0); + UBGraphicsItemUndoCommand *uc = new UBGraphicsItemUndoCommand(scene, mDelegated, 0); UBApplication::undoStack->push(uc); } - } + } } diff --git a/src/domain/UBGraphicsWebView.cpp b/src/domain/UBGraphicsWebView.cpp index ecd9788f..d68bd51d 100644 --- a/src/domain/UBGraphicsWebView.cpp +++ b/src/domain/UBGraphicsWebView.cpp @@ -30,7 +30,7 @@ UBGraphicsWebView::UBGraphicsWebView(QGraphicsItem* parent) : { setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); - mDelegate = new UBGraphicsItemDelegate(this,0, true, false, false); + mDelegate = new UBGraphicsItemDelegate(this, 0, true, false, false); mDelegate->init(); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);