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(addImportAction);
|
||||
addedImports.remove(import);
|
||||
delete addImportAction;
|
||||
} else {
|
||||
removedImports.insert(import, action);
|
||||
}
|
||||
@@ -67,13 +66,11 @@ void RewriteActionCompressor::compressImports(QList<RewriteAction *> &actions) c
|
||||
if (RewriteAction *duplicateAction = addedImports.value(import, 0)) {
|
||||
actionsToRemove.append(duplicateAction);
|
||||
addedImports.remove(import);
|
||||
delete duplicateAction;
|
||||
addedImports.insert(import, action);
|
||||
} else if (RewriteAction *removeAction = removedImports.value(import, 0)) {
|
||||
actionsToRemove.append(action);
|
||||
actionsToRemove.append(removeAction);
|
||||
removedImports.remove(import);
|
||||
delete removeAction;
|
||||
} else {
|
||||
addedImports.insert(import, action);
|
||||
}
|
||||
|
Reference in New Issue
Block a user