[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/server as_object.cpp
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash/server as_object.cpp |
Date: |
Tue, 23 Jan 2007 22:38:34 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/01/23 22:38:34
Modified files:
server : as_object.cpp
Log message:
Dunno how last fix of instanceOf was reverted
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.29&r2=1.30
Patches:
Index: as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- as_object.cpp 23 Jan 2007 19:29:35 -0000 1.29
+++ as_object.cpp 23 Jan 2007 22:38:34 -0000 1.30
@@ -315,11 +315,17 @@
bool
as_object::instanceOf(as_function* ctor)
{
- as_object* proto=m_prototype.get();
- do {
- if ( proto == ctor->getPrototype() ) return true;
- proto = ctor->getPrototype();
- } while (proto);
+ const as_object* obj = this;
+
+ std::set<const as_object*> visited;
+
+ while (obj && visited.insert(obj).second )
+ {
+ if ( obj->get_prototype() == ctor->getPrototype() ) return true;
+ obj = obj->get_prototype();
+ }
+
+ if ( obj ) log_warning("Circular inheritance chain detected during
instanceOf call");
return false;
}