From 57cb0b342004378ad4065f07443ab1d835aefaad Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sun, 5 Feb 2017 18:50:57 +0100 Subject: fix crash when inserting nodes Fixed bugs: - https://launchpad.net/bugs/1617615 (bzr r15479) --- src/ui/tool/multi-path-manipulator.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/ui/tool') diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h index c908cede2..4f152e0a2 100644 --- a/src/ui/tool/multi-path-manipulator.h +++ b/src/ui/tool/multi-path-manipulator.h @@ -82,8 +82,19 @@ private: template void invokeForAll(R (PathManipulator::*method)()) { - for (MapType::iterator i = _mmap.begin(); i != _mmap.end(); ++i) { - ((i->second.get())->*method)(); + for (MapType::iterator i = _mmap.begin(); i != _mmap.end(); ) { + // Sometimes the PathManipulator got freed at loop end, thus + // invalidating the iterator so make sure that next_i will + // be a valid iterator and then assign i to it. + MapType::iterator next_i = i; + ++next_i; + // i->second is a boost::shared_ptr so try to hold on to it so + // it won't get freed prematurely by the WriteXML() method or + // whatever. See https://bugs.launchpad.net/inkscape/+bug/1617615 + // Applicable to empty paths. + boost::shared_ptr hold(i->second); + ((hold.get())->*method)(); + i = next_i; } } template -- cgit v1.2.3 From 1e3e159499532a145cf09af2dbd1de2ae4d8d565 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 6 Feb 2017 15:34:17 +0000 Subject: Remove some unneeded < C++11 fallback code (bzr r15485) --- src/ui/tool/node.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/ui/tool') diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index 025c460e2..a05f0e3b9 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -20,12 +20,7 @@ #include #include #include - -#if __cplusplus >= 201103L #include -#else -#include -#endif #include #include -- cgit v1.2.3