gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11194: Mark AVM2 Global as reachabl


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11194: Mark AVM2 Global as reachable or Gnash will crash.
Date: Wed, 01 Jul 2009 18:44:21 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11194
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2009-07-01 18:44:21 +0200
message:
  Mark AVM2 Global as reachable or Gnash will crash.
  
  Declare some more AS3 classes.
  
  Don't execute null ABC blocks.
  
  Correct lookup of built-in classes.
modified:
  libcore/ClassHierarchy.h
  libcore/asobj/Global.cpp
  libcore/namedStrings.cpp
  libcore/namedStrings.h
  libcore/parser/abc_block.cpp
  libcore/swf/DoABCTag.h
  libcore/vm/Machine.cpp
  libcore/vm/Machine.h
  libcore/vm/VM.cpp
    ------------------------------------------------------------
    revno: 11188.1.26
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 16:32:49 +0200
    message:
      Global is the public namespace 0, not an anonymous one.
    modified:
      libcore/ClassHierarchy.h
    ------------------------------------------------------------
    revno: 11188.1.27
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 16:33:28 +0200
    message:
      Look up global classes properly.
    modified:
      libcore/parser/abc_block.cpp
    ------------------------------------------------------------
    revno: 11188.1.28
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 16:55:11 +0200
    message:
      Check a namespace exists before using it. Look in global namespace only
      if it doesn't (not verified).
    modified:
      libcore/parser/abc_block.cpp
    ------------------------------------------------------------
    revno: 11188.1.29
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 17:23:58 +0200
    message:
      Stop faking classes.
    modified:
      libcore/parser/abc_block.cpp
    ------------------------------------------------------------
    revno: 11188.1.30
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 17:32:54 +0200
    message:
      Don't look in as_environment for objects.
    modified:
      libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 11188.1.31
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 17:44:55 +0200
    message:
      Make sure an abc_block exists before using it.
    modified:
      libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 11188.1.32
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 17:50:44 +0200
    message:
      Add Event class.
    modified:
      libcore/namedStrings.cpp
      libcore/namedStrings.h
    ------------------------------------------------------------
    revno: 11188.1.33
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 17:50:58 +0200
    message:
      Load Event and EventDispatcher classes.
    modified:
      libcore/asobj/Global.cpp
    ------------------------------------------------------------
    revno: 11188.1.34
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 17:51:21 +0200
    message:
      Really don't execute ABC tags that aren't parsed correctly.
    modified:
      libcore/swf/DoABCTag.h
    ------------------------------------------------------------
    revno: 11188.1.35
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 17:51:36 +0200
    message:
      Don't try to instantiate classes when there is no ABC block loaded 
(Machine
      was not initiated, perhaps due to faulty ABC parsing).
    modified:
      libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 11188.1.36
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2009-07-01 18:15:52 +0200
    message:
      Mark the AVM2 global as reachable.
    modified:
      libcore/vm/Machine.cpp
      libcore/vm/Machine.h
      libcore/vm/VM.cpp
=== modified file 'libcore/ClassHierarchy.h'
--- a/libcore/ClassHierarchy.h  2009-06-30 09:11:23 +0000
+++ b/libcore/ClassHierarchy.h  2009-07-01 14:32:49 +0000
@@ -118,7 +118,7 @@
                mGlobal(global),
         mExtension(e) ,
                mAnonNamespaces(),
-        mGlobalNamespace(anonNamespace(0)),
+        mGlobalNamespace(addNamespace(0)),
                mClassMemory()
 #ifdef ENABLE_AVM2
         ,

=== modified file 'libcore/asobj/Global.cpp'
--- a/libcore/asobj/Global.cpp  2009-07-01 11:41:58 +0000
+++ b/libcore/asobj/Global.cpp  2009-07-01 15:50:58 +0000
@@ -51,6 +51,8 @@
 #include "flash/display/DisplayObject_as.h"
 #include "flash/display/MovieClip_as.h"
 #include "flash/display/Sprite_as.h"
+#include "flash/events/Event_as.h"
+#include "flash/events/EventDispatcher_as.h"
 #include "MovieClipLoader.h"
 #include "movie_definition.h"
 #include "NetConnection_as.h"
@@ -448,7 +450,14 @@
         
         // Accessibility classes
         (N(accessibility_class_init, NSV::CLASS_ACCESSIBILITY,
-           NSV::CLASS_OBJECT, NSV::NS_FLASH_ACCESSIBILITY, 5));
+           NSV::CLASS_OBJECT, NSV::NS_FLASH_ACCESSIBILITY, 5))
+       
+        // Event classes
+        (N(event_class_init, NSV::CLASS_EVENT,
+           NSV::CLASS_OBJECT, NSV::NS_FLASH_EVENTS, 5))
+        (N(eventdispatcher_class_init, NSV::CLASS_EVENTDISPATCHER,
+           NSV::CLASS_OBJECT, NSV::NS_FLASH_EVENTS, 5));
+        
 
     return s;
 }

=== modified file 'libcore/namedStrings.cpp'
--- a/libcore/namedStrings.cpp  2009-07-01 11:29:51 +0000
+++ b/libcore/namedStrings.cpp  2009-07-01 15:50:44 +0000
@@ -196,6 +196,7 @@
        string_table::svt( "ContextMenu", NSV::CLASS_CONTEXTMENU ),
        string_table::svt( "MovieClipLoader", NSV::CLASS_MOVIE_CLIP_LOADER ),
        string_table::svt( "Error", NSV::CLASS_ERROR ),
+       string_table::svt( "Event", NSV::CLASS_EVENT),
        string_table::svt( "EventDispatcher", NSV::CLASS_EVENTDISPATCHER),
        string_table::svt( "DisplayObject", NSV::CLASS_DISPLAYOBJECT),
        string_table::svt( "InteractiveObject", NSV::CLASS_INTERACTIVEOBJECT ),

=== modified file 'libcore/namedStrings.h'
--- a/libcore/namedStrings.h    2009-07-01 11:29:51 +0000
+++ b/libcore/namedStrings.h    2009-07-01 15:50:44 +0000
@@ -62,6 +62,7 @@
         CLASS_DISPLAYOBJECT,
         CLASS_DISPLAYOBJECTCONTAINER,
         CLASS_ERROR,
+        CLASS_EVENT,
         CLASS_EVENTDISPATCHER,
         CLASS_FUNCTION,
         CLASS_INT,

=== modified file 'libcore/parser/abc_block.cpp'
--- a/libcore/parser/abc_block.cpp      2009-06-30 09:12:07 +0000
+++ b/libcore/parser/abc_block.cpp      2009-07-01 15:23:58 +0000
@@ -325,12 +325,10 @@
     :
     _stringTable(&VM::get().getStringTable())
 {
-#if 1
-       mCH = 
&(dynamic_cast<AVM2Global*>(VM::get().getMachine()->global())->classHierarchy());
+       mCH = VM::get().getMachine()->classHierarchy();
        // TODO: Make this the real 'Object' prototype.
        mCH->getGlobalNs()->stubPrototype(*mCH, NSV::CLASS_OBJECT);
        mTheObject = mCH->getGlobalNs()->getClass(NSV::CLASS_OBJECT);
-#endif
 }
 
 void
@@ -436,9 +434,21 @@
                                return found;
                }
        }
-       // One last chance: Look globally.
-       found = mCH->getGlobalNs()->getClass(m.getABCName());
-    return found;
+
+
+    // Look in known built-in classes.
+    asNamespace* nsToFind = m.getNamespace();
+
+    // If there is no namespace specified, look in global only.
+    // TODO: check if this is correct, or if there should always be
+    // a namespace.
+    if (!nsToFind) {
+        return mCH->getGlobalNs()->getClass(m.getGlobalName());
+    }
+
+    // Else look in the specified namespace only.
+    asNamespace* ns = mCH->findNamespace(nsToFind->getURI());
+    return ns ? ns->getClass(m.getGlobalName()) : 0;
 
 }
 
@@ -958,15 +968,9 @@
                        {
                                log_error(_("ABC: Super type not found (%s), 
faking."), 
                                        _stringTable->value(
-                        _multinamePool[super_index].getABCName()));
-
-                               // While testing, we will add a fake type, 
rather than abort.
-                               pSuper = mCH->newClass();
-                               
pSuper->setName(_multinamePool[super_index].getABCName());
-                               mCH->getGlobalNs()->addClass(
-                        _multinamePool[super_index].getABCName(), pSuper);
-                               // return false;
-                       }
+                        _multinamePool[super_index].getGlobalName()));
+                           return false;
+            }
 
                        if (pSuper->isFinal())
                        {

=== modified file 'libcore/swf/DoABCTag.h'
--- a/libcore/swf/DoABCTag.h    2009-06-30 06:03:37 +0000
+++ b/libcore/swf/DoABCTag.h    2009-07-01 15:51:21 +0000
@@ -44,6 +44,12 @@
 
     virtual void execute(MovieClip* m, DisplayList& /* dlist */) const
        {
+
+        if (!_abc) {
+            log_debug("Not executing ABC tag because we failed to parse it");
+            return;
+        }
+
                VM& vm = m->getVM();
         
         log_debug("getting machine.");

=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp    2009-07-01 11:46:51 +0000
+++ b/libcore/vm/Machine.cpp    2009-07-01 16:15:52 +0000
@@ -3157,9 +3157,20 @@
 }
 
 void
+Machine::markReachableResources() const
+{
+    _global->setReachable();
+}
+
+void
 Machine::instantiateClass(std::string className, as_object* /*global*/)
 {
 
+    if (!mPoolObject) {
+        log_debug("No ABC block! Can't instantiate class!");
+        return;
+    }
+
     log_debug("instantiateClass: class name %s", className);
 
        asClass* cl = mPoolObject->locateClass(className);
@@ -3232,20 +3243,7 @@
                }
        }
 
-       as_object *target = 0;
-       as_environment env = as_environment(_vm);
-       std::string name = pool_string(multiname.getABCName(), mPoolObject);
-       std::string ns = pool_string(multiname.getNamespace()->getAbcURI(),
-            mPoolObject);
-       std::string path = ns.empty() ? name : ns + "." + name;
-
-    log_abc("Failed to find property in scope stack. Looking for %s in "
-        "as_environment", path);
-
-    std::auto_ptr<as_environment::ScopeStack> envStack (getScopeStack());
-       val = env.get_variable(path, *envStack, &target);
-
-       push_stack(target);     
+    log_abc("Failed to find property in scope stack.");
        return val;
 }
 

=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h      2009-07-01 12:49:14 +0000
+++ b/libcore/vm/Machine.h      2009-07-01 16:15:52 +0000
@@ -238,6 +238,8 @@
         return &_global->classHierarchy();
     }
 
+    void markReachableResources() const;
+
 private:
        /// The state of the machine.
        class State

=== modified file 'libcore/vm/VM.cpp'
--- a/libcore/vm/VM.cpp 2009-06-30 09:12:37 +0000
+++ b/libcore/vm/VM.cpp 2009-07-01 16:15:52 +0000
@@ -242,6 +242,10 @@
 
        _global->setReachable();
 
+#if ENABLE_AVM2
+    _machine->markReachableResources();
+#endif
+
        /// Mark all static GcResources
        for (ResVect::const_iterator i=_statics.begin(), e=_statics.end(); 
i!=e; ++i)
        {


reply via email to

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