From 258e7ba7fabc54ebb7fc844437eaf36231066ef5 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 2 Jul 2010 00:40:46 -0700 Subject: [PATCH] Leave swatches when doing a vacuum pass. Fixes bug #594445. --- src/sp-object.cpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 420c7b4a6..3b0056b41 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -539,29 +539,31 @@ SPObject::setLabel(gchar const *label) { /** Queues the object for orphan collection */ -void -SPObject::requestOrphanCollection() { +void SPObject::requestOrphanCollection() { g_return_if_fail(document != NULL); // do not remove style or script elements (Bug #276244) - if (SP_IS_STYLE_ELEM(this)) - return; - if (SP_IS_SCRIPT(this)) - return; - - document->queueForOrphanCollection(this); + if (SP_IS_STYLE_ELEM(this)) { + // leave it + } else if (SP_IS_SCRIPT(this)) { + // leave it + } else if (SP_IS_PAINT_SERVER(this) && static_cast(this)->isSwatch() ) { + // leave it + } else { + document->queueForOrphanCollection(this); - /** \todo - * This is a temporary hack added to make fill&stroke rebuild its - * gradient list when the defs are vacuumed. gradient-vector.cpp - * listens to the modified signal on defs, and now we give it that - * signal. Mental says that this should be made automatic by - * merging SPObjectGroup with SPObject; SPObjectGroup would issue - * this signal automatically. Or maybe just derive SPDefs from - * SPObjectGroup? - */ + /** \todo + * This is a temporary hack added to make fill&stroke rebuild its + * gradient list when the defs are vacuumed. gradient-vector.cpp + * listens to the modified signal on defs, and now we give it that + * signal. Mental says that this should be made automatic by + * merging SPObjectGroup with SPObject; SPObjectGroup would issue + * this signal automatically. Or maybe just derive SPDefs from + * SPObjectGroup? + */ - this->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG); + this->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG); + } } /** Sends the delete signal to all children of this object recursively */ -- 2.30.2