summaryrefslogtreecommitdiffstats
path: root/src/widgets/gradient-selector.cpp
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2015-09-05 23:21:37 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2015-09-05 23:21:37 +0000
commit3822efebe63b5d367a80786f8c3ce38113c22184 (patch)
tree19b54f990027d86932176469999b616593ff0b58 /src/widgets/gradient-selector.cpp
parentQuick fix for previous fix (i cannot understand why the previous fix still wo... (diff)
downloadinkscape-3822efebe63b5d367a80786f8c3ce38113c22184.tar.gz
inkscape-3822efebe63b5d367a80786f8c3ce38113c22184.zip
Attempt to fix 1417173 (undo duplicate gradient crash)
Fixed bugs: - https://launchpad.net/bugs/1417173 (bzr r14345)
Diffstat (limited to 'src/widgets/gradient-selector.cpp')
-rw-r--r--src/widgets/gradient-selector.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp
index 402f30846..63599f3f9 100644
--- a/src/widgets/gradient-selector.cpp
+++ b/src/widgets/gradient-selector.cpp
@@ -555,6 +555,10 @@ sp_gradient_selector_add_vector_clicked (GtkWidget */*w*/, SPGradientSelector *s
if (gr) {
repr = gr->getRepr()->duplicate(xml_doc);
+ // Rename the new gradients id to be similar to the cloned gradients
+ Glib::ustring old_id = gr->getId();
+ rename_id(gr, old_id);
+ doc->getDefs()->getRepr()->addChild(repr, NULL);
} else {
repr = xml_doc->createElement("svg:linearGradient");
Inkscape::XML::Node *stop = xml_doc->createElement("svg:stop");
@@ -567,17 +571,10 @@ sp_gradient_selector_add_vector_clicked (GtkWidget */*w*/, SPGradientSelector *s
stop->setAttribute("style", "stop-color:#fff;stop-opacity:1;");
repr->appendChild(stop);
Inkscape::GC::release(stop);
+ doc->getDefs()->getRepr()->addChild(repr, NULL);
+ gr = SP_GRADIENT(doc->getObjectByRepr(repr));
}
-
- doc->getDefs()->getRepr()->addChild(repr, NULL);
-
- Glib::ustring old_id = gr->getId();
-
- gr = SP_GRADIENT(doc->getObjectByRepr(repr));
-
- // Rename the new gradients id to be similar to the cloned gradients
- rename_id(gr, old_id);
-
+
sp_gradient_vector_selector_set_gradient( SP_GRADIENT_VECTOR_SELECTOR (sel->vectors), doc, gr);
sel->selectGradientInTree(gr);