Commit 880877ae authored by Guillaume Burel's avatar Guillaume Burel

Segfault when removing widget containing flash content fixed.

parent a80d2785
...@@ -387,14 +387,19 @@ void UBGraphicsItemDelegate::remove(bool canUndo) ...@@ -387,14 +387,19 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
scene->removeItem(button); scene->removeItem(button);
scene->removeItem(mFrame); 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<UBGraphicsWebView*>(mDelegated);
if (mDelegated_casted)
mDelegated_casted->setHtml(QString());
scene->removeItem(mDelegated); scene->removeItem(mDelegated);
if (canUndo) if (canUndo)
{ {
UBGraphicsItemUndoCommand *uc = new UBGraphicsItemUndoCommand((UBGraphicsScene*) scene, mDelegated, 0); UBGraphicsItemUndoCommand *uc = new UBGraphicsItemUndoCommand(scene, mDelegated, 0);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
} }
} }
} }
......
...@@ -30,7 +30,7 @@ UBGraphicsWebView::UBGraphicsWebView(QGraphicsItem* parent) : ...@@ -30,7 +30,7 @@ UBGraphicsWebView::UBGraphicsWebView(QGraphicsItem* parent) :
{ {
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
mDelegate = new UBGraphicsItemDelegate(this,0, true, false, false); mDelegate = new UBGraphicsItemDelegate(this, 0, true, false, false);
mDelegate->init(); mDelegate->init();
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
......
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