From f70b4daa0d53567b20bde6d86b69c1f89be402c8 Mon Sep 17 00:00:00 2001 From: Ian Bruce Date: Sun, 29 Jul 2018 07:56:35 +0000 Subject: temporary fix for bug where undo/redo does not restore node-type changes This is not intended to be a permanent patch, but to point out the actual source of a problem where undo/redo does not work for node-type changes. It works by disabling the function of the PathManipulator::_nodetypesKey() method, to match some breakage which has apparently occurred somewhere else. Presumably, somebody would know where that was. Once that is located and fixed, this patch will be unnecessary, except for a minor code cleanup. At that point, the functional change would itself constitute a bug, instead of a temporary fix. Full details are available at . --- src/ui/tool/path-manipulator.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index d5e111c7b..8309dbe0e 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -193,20 +193,23 @@ void PathManipulator::writeXML() { if (!_live_outline) _updateOutline(); + _setGeometry(); - if (!_path) return; - _observer->block(); - if (!empty()) { - _path->updateRepr(); - _getXMLNode()->setAttribute(_nodetypesKey().data(), _createTypeString().data()); - } else { - // this manipulator will have to be destroyed right after this call - _getXMLNode()->removeObserver(*_observer); - _path->deleteObject(true, true); - _path = nullptr; + if (_path) { + _observer->block(); + if (!empty()) { + _path->updateRepr(); + _getXMLNode()->setAttribute(_nodetypesKey().data(), _createTypeString().data()); + } + else { + // this manipulator will have to be destroyed right after this call + _getXMLNode()->removeObserver(*_observer); + _path->deleteObject(true, true); + _path = nullptr; + } + _observer->unblock(); } - _observer->unblock(); } /** Remove all nodes from the path. */ @@ -1522,8 +1525,12 @@ void PathManipulator::_setGeometry() /** Figure out in what attribute to store the nodetype string. */ Glib::ustring PathManipulator::_nodetypesKey() { - if (_lpe_key.empty()) return "sodipodi:nodetypes"; - return _lpe_key + "-nodetypes"; + // temporary fix + // if (_lpe_key.empty()) + if (false) + return ("sodipodi:nodetypes"); + else + return (_lpe_key + "-nodetypes"); } /** Return the XML node we are editing. -- cgit v1.2.3