From 04641657d040c0fe3035e9ac7877b279dfa630cb Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 24 Dec 2019 12:52:16 +0100 Subject: [PATCH] fixes #0004233: Access violation and file corruption on undo duplicate sketch --- src/Mod/PartDesign/Gui/CommandBody.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Mod/PartDesign/Gui/CommandBody.cpp b/src/Mod/PartDesign/Gui/CommandBody.cpp index 9351f59877..4e353d949b 100644 --- a/src/Mod/PartDesign/Gui/CommandBody.cpp +++ b/src/Mod/PartDesign/Gui/CommandBody.cpp @@ -643,9 +643,11 @@ void CmdPartDesignDuplicateSelection::activated(int iMsg) std::vector beforeFeatures = getDocument()->getObjects(); - openCommand("Duplicate a PartDesign object"); doCommand(Doc,"FreeCADGui.runCommand('Std_DuplicateSelection')"); + // This transaction must be opened after using the core duplication function. + // See https://forum.freecadweb.org/viewtopic.php?f=19&t=41918&p=355939#p355939 + openCommand("Duplicate a PartDesign object"); if (pcActiveBody) { // Find the features that were added std::vector afterFeatures = getDocument()->getObjects();