forked from qt-creator/qt-creator
QmlDesigner: Fix crash
We have to call updateEnabledViews() in the correct places. AbstractView::modelAboutToBeDetached() was to late, since the view is already removed at this point. Change-Id: I6d71d5ea773fb7ec8ec258344498a229a30dd9b3 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -185,11 +185,7 @@ is removing the reference to the model from the view.
|
||||
*/
|
||||
void AbstractView::modelAboutToBeDetached(Model *)
|
||||
{
|
||||
Model *oldModel = model();
|
||||
removeModel();
|
||||
|
||||
if (oldModel)
|
||||
oldModel->d->updateEnabledViews();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@@ -101,6 +101,7 @@ void ModelPrivate::detachAllViews()
|
||||
detachView(view.data(), true);
|
||||
|
||||
m_viewList.clear();
|
||||
updateEnabledViews();
|
||||
|
||||
if (m_nodeInstanceView) {
|
||||
m_nodeInstanceView->modelAboutToBeDetached(m_q);
|
||||
@@ -951,6 +952,7 @@ void ModelPrivate::detachView(AbstractView *view, bool notifyView)
|
||||
if (notifyView)
|
||||
view->modelAboutToBeDetached(m_q);
|
||||
m_viewList.removeOne(view);
|
||||
updateEnabledViews();
|
||||
}
|
||||
|
||||
void ModelPrivate::notifyNodeCreated(const InternalNode::Pointer &newInternalNodePointer)
|
||||
|
Reference in New Issue
Block a user