forked from qt-creator/qt-creator
QmlDesigner: Fix double deletion of rewriter actions
Actions were deleted after being inserted into actionsToRemove, which caused them to get deleted again, leading to crash. Change-Id: If6597f117859ca92cfc5af67c730e2f84e5c0639 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -58,7 +58,6 @@ void RewriteActionCompressor::compressImports(QList<RewriteAction *> &actions) c
|
|||||||
actionsToRemove.append(action);
|
actionsToRemove.append(action);
|
||||||
actionsToRemove.append(addImportAction);
|
actionsToRemove.append(addImportAction);
|
||||||
addedImports.remove(import);
|
addedImports.remove(import);
|
||||||
delete addImportAction;
|
|
||||||
} else {
|
} else {
|
||||||
removedImports.insert(import, action);
|
removedImports.insert(import, action);
|
||||||
}
|
}
|
||||||
@@ -67,13 +66,11 @@ void RewriteActionCompressor::compressImports(QList<RewriteAction *> &actions) c
|
|||||||
if (RewriteAction *duplicateAction = addedImports.value(import, 0)) {
|
if (RewriteAction *duplicateAction = addedImports.value(import, 0)) {
|
||||||
actionsToRemove.append(duplicateAction);
|
actionsToRemove.append(duplicateAction);
|
||||||
addedImports.remove(import);
|
addedImports.remove(import);
|
||||||
delete duplicateAction;
|
|
||||||
addedImports.insert(import, action);
|
addedImports.insert(import, action);
|
||||||
} else if (RewriteAction *removeAction = removedImports.value(import, 0)) {
|
} else if (RewriteAction *removeAction = removedImports.value(import, 0)) {
|
||||||
actionsToRemove.append(action);
|
actionsToRemove.append(action);
|
||||||
actionsToRemove.append(removeAction);
|
actionsToRemove.append(removeAction);
|
||||||
removedImports.remove(import);
|
removedImports.remove(import);
|
||||||
delete removeAction;
|
|
||||||
} else {
|
} else {
|
||||||
addedImports.insert(import, action);
|
addedImports.insert(import, action);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user