summaryrefslogtreecommitdiffstats
path: root/src/style-internal.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2019-10-24 16:21:53 +0000
committerTavmjong Bah <tavmjong@free.fr>2019-10-24 16:21:53 +0000
commit2b9eeffadbce92b9aa38e3edd9211329b0ec8c97 (patch)
treec7fbad475d80ab2a8039c69fa19d12988ca7df94 /src/style-internal.cpp
parentupdate expected_rendering/test-baseline-shift.png (diff)
downloadinkscape-2b9eeffadbce92b9aa38e3edd9211329b0ec8c97.tar.gz
inkscape-2b9eeffadbce92b9aa38e3edd9211329b0ec8c97.zip
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
Diffstat (limited to 'src/style-internal.cpp')
-rw-r--r--src/style-internal.cpp16
1 files changed, 12 insertions, 4 deletions
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 {