From d700b8471495bd4af41a7e907ee0ccd6bf2f0f07 Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@nokia.com> Date: Fri, 5 Mar 2010 15:11:05 +0100 Subject: [PATCH] QmlDesigner: Fix crash when opening a .qml file with states This fixes an assert in QGraphicsScene because of overlapping deferred calls of _q_processDirtyItems & _q_emitUpdated. Both used to be queued in the same event loop: _q_emitUpdated call queued with "calledEmitUpdated=true" _q_processDirtyItems call queued -> Event loop runs _q_emitUpdated runs, setting "calledEmitUpdated=false" _q_processDirtyItems runs, asserting because of !calledEmitUpdated This fix forces the event loop to run between the queueing of _q_emitUpdated & _q_processDirtyItems, effectively separating both calls. Task-number: BAUHAUS-459 Reviewed-by: Christiaan Janssen --- .../components/stateseditor/stateseditorwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp index 028bdc32f43..284e2b88618 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp @@ -166,6 +166,10 @@ StatesEditorWidget::StatesEditorWidget(QWidget *parent): m_d->listView->rootContext()->setContextProperty(QLatin1String("statesEditorModel"), m_d->statesEditorModel.data()); + // Work around ASSERT in the internal QGraphicsScene that happens when + // the scene is created + items set dirty in one event loop run (BAUHAUS-459) + QApplication::processEvents(); + m_d->listView->setSource(QUrl("qrc:/stateseditor/stateslist.qml")); if (!m_d->listView->rootObject()) -- GitLab