Skip to content
Snippets Groups Projects
Commit 6956eb1d authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

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: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 4da344c0
No related branches found
No related tags found
No related merge requests found
...@@ -392,7 +392,6 @@ void DesignDocument::activateCurrentModel(TextModifier *textModifier) ...@@ -392,7 +392,6 @@ void DesignDocument::activateCurrentModel(TextModifier *textModifier)
// m_formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo()); // m_formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
m_documentLoaded = true; m_documentLoaded = true;
m_subComponentManager->update(QUrl::fromLocalFile(fileName()), m_currentModel->imports());
Q_ASSERT(m_documentModel); Q_ASSERT(m_documentModel);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }
...@@ -407,6 +406,7 @@ void DesignDocument::activateCurrentModel() ...@@ -407,6 +406,7 @@ void DesignDocument::activateCurrentModel()
void DesignDocument::activateDocumentModel() void DesignDocument::activateDocumentModel()
{ {
//this function seems to be unused!
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
Q_ASSERT(m_documentModel); Q_ASSERT(m_documentModel);
...@@ -417,7 +417,9 @@ void DesignDocument::activateDocumentModel() ...@@ -417,7 +417,9 @@ void DesignDocument::activateDocumentModel()
m_currentModel = m_documentModel; m_currentModel = m_documentModel;
m_documentLoaded = true; m_documentLoaded = true;
m_subComponentManager->update(QUrl::fromLocalFile(fileName()), m_currentModel->imports());
updateSubcomponentManager();
Q_ASSERT(m_documentModel); Q_ASSERT(m_documentModel);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }
...@@ -443,6 +445,12 @@ void DesignDocument::close() ...@@ -443,6 +445,12 @@ void DesignDocument::close()
emit designDocumentClosed(); emit designDocumentClosed();
} }
void DesignDocument::updateSubcomponentManager()
{
Q_ASSERT(m_subComponentManager);
m_subComponentManager->update(QUrl::fromLocalFile(fileName()), m_currentModel->imports());
}
void DesignDocument::deleteSelected() void DesignDocument::deleteSelected()
{ {
if (!m_currentModel) if (!m_currentModel)
......
...@@ -82,6 +82,7 @@ public: ...@@ -82,6 +82,7 @@ public:
void activateCurrentModel(); void activateCurrentModel();
void activateDocumentModel(); void activateDocumentModel();
void close(); void close();
void updateSubcomponentManager();
bool isUndoAvailable() const; bool isUndoAvailable() const;
bool isRedoAvailable() const; bool isRedoAvailable() const;
......
...@@ -302,6 +302,7 @@ void QmlDesignerPlugin::activateAutoSynchronization() ...@@ -302,6 +302,7 @@ void QmlDesignerPlugin::activateAutoSynchronization()
m_mainWidget->showErrorMessage(errors); m_mainWidget->showErrorMessage(errors);
} }
currentDesignDocument()->updateSubcomponentManager();
connect(currentDesignDocument()->rewriterView(), connect(currentDesignDocument()->rewriterView(),
SIGNAL(errorsChanged(QList<RewriterView::Error>)), SIGNAL(errorsChanged(QList<RewriterView::Error>)),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment