summaryrefslogtreecommitdiffstats
path: root/src/style.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.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.cpp')
-rw-r--r--src/style.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/style.cpp b/src/style.cpp
index b54d3feda..a985908b1 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -1229,11 +1229,21 @@ sp_repr_sel_eng()
void
sp_style_set_ipaint_to_uri(SPStyle *style, SPIPaint *paint, const Inkscape::URI *uri, SPDocument *document)
{
- // std::cout << "sp_style_set_ipaint_to_uri: Entrance: " << uri << " " << (void*)document << std::endl;
- // it may be that this style's SPIPaint has not yet created its URIReference;
- // now that we have a document, we can create it here
- if (!paint->value.href && document) {
- paint->value.href = new SPPaintServerReference(document);
+ if (!paint->value.href) {
+
+ if (style->object) {
+ // Should not happen as href should have been created in SPIPaint. (TODO: Removed code duplication.)
+ paint->value.href = new SPPaintServerReference(style->object);
+
+ } else if (document) {
+ // Used by desktop style (no object to attach to!).
+ paint->value.href = new SPPaintServerReference(document);
+
+ } else {
+ std::cerr << "sp_style_set_ipaint_to_uri: No valid object or document!" << std::endl;
+ return;
+ }
+
if (paint == &style->fill) {
style->fill_ps_changed_connection = paint->value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_fill_paint_server_ref_changed), style));
} else {