QmlDesigner: crash fix

The subcomponent manager populates the item library.
This means the ItemLibraryView has to be properly
initialized before we call m_subComponentManager->update().

I added a helper function and call it from activateAutoSynchronization(),
after all views have been attached.

Change-Id: Ie802f93c7d0a76b42160d4a92e8448e900380b71
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Thomas Hartmann
2013-01-29 09:50:31 +01:00
parent 4da344c0bf
commit 6956eb1d84
3 changed files with 12 additions and 2 deletions

View File

@@ -392,7 +392,6 @@ void DesignDocument::activateCurrentModel(TextModifier *textModifier)
// m_formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
m_documentLoaded = true;
m_subComponentManager->update(QUrl::fromLocalFile(fileName()), m_currentModel->imports());
Q_ASSERT(m_documentModel);
QApplication::restoreOverrideCursor();
}
@@ -407,6 +406,7 @@ void DesignDocument::activateCurrentModel()
void DesignDocument::activateDocumentModel()
{
//this function seems to be unused!
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
Q_ASSERT(m_documentModel);
@@ -417,7 +417,9 @@ void DesignDocument::activateDocumentModel()
m_currentModel = m_documentModel;
m_documentLoaded = true;
m_subComponentManager->update(QUrl::fromLocalFile(fileName()), m_currentModel->imports());
updateSubcomponentManager();
Q_ASSERT(m_documentModel);
QApplication::restoreOverrideCursor();
}
@@ -443,6 +445,12 @@ void DesignDocument::close()
emit designDocumentClosed();
}
void DesignDocument::updateSubcomponentManager()
{
Q_ASSERT(m_subComponentManager);
m_subComponentManager->update(QUrl::fromLocalFile(fileName()), m_currentModel->imports());
}
void DesignDocument::deleteSelected()
{
if (!m_currentModel)