From 43295895d62d3f8a179811302d70fc51c1616c59 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 25 Feb 2020 17:10:42 +0100 Subject: [PATCH] Gui: [skip ci] fix regression in Document::setEdit() For more details see: https://forum.freecadweb.org/viewtopic.php?f=19&t=43629&p=371972#p371972 --- src/Gui/Document.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index e17726700f..93126e6b61 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -287,6 +287,14 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname) FC_ERR("cannot edit non ViewProviderDocumentObject"); return false; } + + // Fix regression: https://forum.freecadweb.org/viewtopic.php?f=19&t=43629&p=371972#p371972 + // When an object is already in edit mode a subsequent call for editing is only possible + // when resetting the currently edited object. + if (d->_editViewProvider) { + _resetEdit(); + } + auto obj = vp->getObject(); if(!obj->getNameInDocument()) { FC_ERR("cannot edit detached object");