Commit 5b65a60e authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlDesigner: Switch back to edit mode if last .qml file closes

Fixes multiple ways to crash QmlDesigner after last .qml file is closed
by enforcing a switch to Edit mode then.

Patch originally done by con.
parent 0531e800
......@@ -207,7 +207,7 @@ void DesignMode::unregisterDesignWidget(QWidget *widget)
// if editor changes, check if we have valid mimetype registered.
void DesignMode::currentEditorChanged(Core::IEditor *editor)
{
if (d->m_currentEditor.data() == editor)
if (editor && (d->m_currentEditor.data() == editor))
return;
bool mimeEditorAvailable = false;
......@@ -239,6 +239,8 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
if (!mimeEditorAvailable) {
setActiveContext(QList<int>());
if (core->modeManager()->currentMode() == this)
core->modeManager()->activateMode(Core::Constants::MODE_EDIT);
setEnabled(false);
d->m_currentEditor = QWeakPointer<Core::IEditor>();
emit actionsUpdated(d->m_currentEditor.data());
......
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