gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1635-gc5f7578
Date: Wed, 03 Jul 2013 14:13:33 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  c5f757809a5cf900c401c2b38b7bdaa8c6c29983 (commit)
      from  404343a510a88352b465ae37026102cd1df705e0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=c5f757809a5cf900c401c2b38b7bdaa8c6c29983


commit c5f757809a5cf900c401c2b38b7bdaa8c6c29983
Author: Bastiaan Jacques <address@hidden>
Date:   Wed Jul 3 16:12:08 2013 +0200

    Savannah bug #39404: Don't access a child XML node that has been 
garbage-collected.

diff --git a/libcore/asobj/XMLNode_as.cpp b/libcore/asobj/XMLNode_as.cpp
index 663a8a4..2aee2da 100644
--- a/libcore/asobj/XMLNode_as.cpp
+++ b/libcore/asobj/XMLNode_as.cpp
@@ -110,6 +110,12 @@ XMLNode_as::XMLNode_as(const XMLNode_as& tpl, bool deep)
 
 XMLNode_as::~XMLNode_as()
 {
+    // In practice it is quite likely that the child will be garbage-collected
+    // before the parent. See Savannah bug #39404.
+    if (_parent ) {
+        _parent->removeChild(this);
+    }
+
     clearChildren();
 }
 
@@ -378,10 +384,14 @@ XMLNode_as::extractPrefix(std::string& prefix) const
 void
 XMLNode_as::clearChildren()
 {
-    for (Children::const_iterator it = _children.begin(), e = _children.end();
+    for (Children::iterator it = _children.begin(), e = _children.end();
             it != e; ++it) {
-        const XMLNode_as* node = *it;
+        XMLNode_as* node = *it;
+
+        node->setParent(0);
         if (!node->_object) {
+            // The node is not GC'd because it has no associated object. 
+            // See XMLNode_as class docs.
             delete node;
         }
     }
diff --git a/libcore/asobj/XML_as.cpp b/libcore/asobj/XML_as.cpp
index c20432b..a361856 100644
--- a/libcore/asobj/XML_as.cpp
+++ b/libcore/asobj/XML_as.cpp
@@ -506,7 +506,6 @@ XML_as::parseXML(const std::string& xml)
 void
 XML_as::clear()
 {
-    // TODO: should set childs's parent to NULL ?
     clearChildren();
     _docTypeDecl.clear();
     _xmlDecl.clear();

-----------------------------------------------------------------------

Summary of changes:
 libcore/asobj/XMLNode_as.cpp |   14 ++++++++++++--
 libcore/asobj/XML_as.cpp     |    1 -
 2 files changed, 12 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]