forked from qt-creator/qt-creator
QmlDesigner: fixes crash
Deleting an items might have a side effect that turns the qml code invalid. (e. g. alias properties) We catch this an show a proper error message. Task-number: QTCREATORBUG-2973 Reviewed-by: Kai Koehne
This commit is contained in:
@@ -51,6 +51,7 @@
|
|||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
#include <toolbox.h>
|
#include <toolbox.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
|
#include <rewritingexception.h>
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
@@ -456,6 +457,7 @@ void DesignDocumentController::deleteSelected()
|
|||||||
if (!m_d->model)
|
if (!m_d->model)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
try {
|
||||||
if (m_d->formEditorView) {
|
if (m_d->formEditorView) {
|
||||||
RewriterTransaction transaction(m_d->formEditorView.data());
|
RewriterTransaction transaction(m_d->formEditorView.data());
|
||||||
QList<ModelNode> toDelete = m_d->formEditorView->selectedModelNodes();
|
QList<ModelNode> toDelete = m_d->formEditorView->selectedModelNodes();
|
||||||
@@ -464,6 +466,9 @@ void DesignDocumentController::deleteSelected()
|
|||||||
QmlObjectNode(node).destroy();
|
QmlObjectNode(node).destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
QMessageBox::warning(0, tr("Error"), e.description());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignDocumentController::copySelected()
|
void DesignDocumentController::copySelected()
|
||||||
|
|||||||
Reference in New Issue
Block a user