From 2b9eeffadbce92b9aa38e3edd9211329b0ec8c97 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 24 Oct 2019 18:21:53 +0200 Subject: Fix gradient/mesh handles after object with gradient/mesh cloned. Fixes https://bugs.launchpad.net/inkscape/+bug/453067 Fixes https://gitlab.com/inkscape/inkscape/issues/130 --- src/style-internal.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/style-internal.cpp') diff --git a/src/style-internal.cpp b/src/style-internal.cpp index a1b2afd3d..80f7c1cea 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -1303,7 +1303,7 @@ SPIPaint::read( gchar const *str ) { if ( strneq(str, "url", 3) ) { // FIXME: THE FOLLOWING CODE SHOULD BE PUT IN A PRIVATE FUNCTION FOR REUSE - auto uri = extract_uri(str, &str); + auto uri = extract_uri(str, &str); // std::string if(uri.empty()) { std::cerr << "SPIPaint::read: url is empty or invalid" << std::endl; } else if (!style ) { @@ -1313,9 +1313,17 @@ SPIPaint::read( gchar const *str ) { SPDocument *document = (style->object) ? style->object->document : nullptr; // Create href if not done already - if (!value.href && document) { - // std::cout << " Creating value.href" << std::endl; - value.href = new SPPaintServerReference(document); + if (!value.href) { + + if (style->object) { + value.href = new SPPaintServerReference(style->object); + } else if (document) { + value.href = new SPPaintServerReference(document); + } else { + std::cerr << "SPIPaint::read: No valid object or document!" << std::endl; + return; + } + if (this == &style->fill) { style->fill_ps_changed_connection = value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_fill_paint_server_ref_changed), style)); } else { -- cgit v1.2.3