From 07da321da230c2764da3f2cb12e2648cf1f7df02 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Thu, 21 Nov 2019 11:54:11 +0100 Subject: fix Glib::Regex::match stack-use-after-scope Fixes cursor jumping mentioned by @nathanal: https://gitlab.com/inkscape/inkscape/issues/521#note_247899536 --- src/object/sp-text.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp index 714ebe1d2..79f60c7a8 100644 --- a/src/object/sp-text.cpp +++ b/src/object/sp-text.cpp @@ -1051,7 +1051,12 @@ std::vector SPText::get_shapes() const if (style->shape_inside.set && (val = style->shape_inside.value())) { static Glib::RefPtr regex = Glib::Regex::create("url\\(#([A-z0-9#]*)\\)"); Glib::MatchInfo matchInfo; - regex->match(val, matchInfo); + + // Glib::Regex::match stack-use-after-scope workaround + // https://gitlab.gnome.org/GNOME/glibmm/issues/66 + Glib::ustring val_stack = val; + + regex->match(val_stack, matchInfo); while (matchInfo.matches()) { shapes.push_back(matchInfo.fetch(1)); -- cgit v1.2.3