Code

Patch by Adib for 382313.
[inkscape.git] / src / sp-object.cpp
index 1e7c5f2fe33b3d02c780a369bcc053f67a650e43..85e8a4e9ab4ad8898967f1de925bd74da2dbcb97 100644 (file)
@@ -42,6 +42,8 @@
 #include "style.h"
 #include "sp-object-repr.h"
 #include "sp-root.h"
+#include "sp-style-elem.h"
+#include "sp-script.h"
 #include "streq.h"
 #include "strneq.h"
 #include "xml/repr.h"
@@ -505,6 +507,13 @@ SPObject::setLabel(gchar const *label) {
 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);
 
     /** \todo
@@ -1544,24 +1553,6 @@ SPObject::_requireSVGVersion(Inkscape::Version version) {
     }
 }
 
-/**
- * Return sodipodi version of first root ancestor or (0,0).
- */
-Inkscape::Version
-sp_object_get_sodipodi_version(SPObject *object)
-{
-    static Inkscape::Version const zero_version(0, 0);
-
-    while (object) {
-        if (SP_IS_ROOT(object)) {
-            return SP_ROOT(object)->version.sodipodi;
-        }
-        object = SP_OBJECT_PARENT(object);
-    }
-
-    return zero_version;
-}
-
 /**
  * Returns previous object in sibling list or NULL.
  */