Please note the commented lines inside the 'if'. I expected that
the newClass instruction should push something back on the stack, but running it with those lines uncommented
gives an assert failture sometimes later in incRef. Someone with more knowledge of the codebase may probably easy spot the issue.
The rational behind the change is the following. With Loader.load() an swf is allowed to load another swf as child. Its clearly stated in the documentation that the child's classes will not override the parents classes. This seems to imply that
attempts by the child to register an already known class is not an error condition (it was handled that way before), but should
be ignored.
(Please forgive the uncleanness of the patch)
I got it fully working with the patch below.
Please note the commented lines inside the 'if'. I expected that
the newClass instruction should push something back on the stack, but running it with those lines uncommented
gives an assert failture sometimes later in incRef. Someone with more knowledge of the codebase may probably easy spot the issue.
The rational behind the change is the following. With Loader.load() an swf is allowed to load another swf as child. Its clearly stated in the documentation that the child's classes will not override the parents classes. This seems to imply that
attempts by the child to register an already known class is not an error condition (it was handled that way before), but should
be ignored.
(Please forgive the uncleanness of the patch)
=== modified file 'scripting/ abc_opcodes. cpp' abc_opcodes. cpp 2011-04-29 20:23:44 +0000 abc_opcodes. cpp 2011-05-05 23:41:34 +0000
--- scripting/
+++ scripting/
@@ -2361,14 +2361,26 @@
void ABCVm:: newClass( call_context* th, int n) &th->context- >methods[ th->context- >instances[ n].init] ; th->context- >instances[ n].name; and_throw( name_index) ; >context- >getMultiname( name_index, NULL);
{
- LOG(LOG_CALLS, _("newClass ") << n );
+ LOG(LOG_ERROR, _("newClass ") << n );
method_info* constructor=
int name_index=
assert_
const multiname* mname=th-
assert_ and_throw( mname-> ns.size( )==1); QName(mname- >name_s, mname-> ns[0].name) ); >name_s, mname-> ns[0].name) ; >::iterator i = sys->classes. find(qname) ; ERROR," ABCVm:: newClass: Class does already exist"); stack_pop( ); stack_push( ret);*/ ERROR," Class_inherit from abc_opcodes"); qname); or->validProfNa me)
- Class_inherit* ret=new Class_inherit(
+ QName qname = QName(mname-
+ std::map<QName, Class_base*
+ if(i != sys->classes.end())
+ {
+ LOG(LOG_
+ /*th->runtime_
+ Class_base* ret = i->second;
+ ret->incRef();
+ th->runtime_
+ return;
+ }
+ LOG(LOG_
+ Class_inherit* ret=new Class_inherit(
#ifdef PROFILING_SUPPORT
if(!construct
{