[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11270: Fix an assertion failure I a
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11270: Fix an assertion failure I added to check a signed/unsigned comparison. |
Date: |
Thu, 16 Jul 2009 15:54:32 +0200 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11270
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-07-16 15:54:32 +0200
message:
Fix an assertion failure I added to check a signed/unsigned comparison.
modified:
libcore/asobj/Global_as.h
libcore/asobj/Globals.cpp
libcore/asobj/Globals.h
libcore/movie_root.cpp
libcore/vm/CallStack.cpp
libcore/vm/Machine.cpp
------------------------------------------------------------
revno: 11268.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-07-16 14:46:26 +0200
message:
Add createObject() functions to Global_as.
modified:
libcore/asobj/Global_as.h
libcore/asobj/Globals.h
------------------------------------------------------------
revno: 11268.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-07-16 14:56:51 +0200
message:
Implement createObject() functions. Use them in a couple of places.
modified:
libcore/asobj/Globals.cpp
libcore/vm/CallStack.cpp
libcore/vm/Machine.cpp
------------------------------------------------------------
revno: 11268.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-07-16 15:13:56 +0200
message:
Fix abort in movie_root.
modified:
libcore/movie_root.cpp
=== modified file 'libcore/asobj/Global_as.h'
--- a/libcore/asobj/Global_as.h 2009-07-14 16:15:25 +0000
+++ b/libcore/asobj/Global_as.h 2009-07-16 12:46:26 +0000
@@ -91,6 +91,10 @@
virtual as_object* createBoolean(bool b) = 0;
+ virtual as_object* createObject() = 0;
+
+ virtual as_object* createObject(as_object* prototype) = 0;
+
virtual Global_as& global() {
return *this;
}
=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2009-07-16 08:53:33 +0000
+++ b/libcore/asobj/Globals.cpp 2009-07-16 12:56:51 +0000
@@ -179,6 +179,18 @@
_classes.getGlobalNs()->getClass(NSV::CLASS_STRING)->setDeclared();
}
+as_object*
+AVM1Global::createObject()
+{
+ return new as_object;
+}
+
+as_object*
+AVM1Global::createObject(as_object* prototype)
+{
+ return new as_object(prototype);
+}
+
builtin_function*
AVM1Global::createFunction(Global_as::ASFunction function)
{
@@ -209,6 +221,18 @@
{
return init_boolean_instance(*this, b);
}
+
+as_object*
+AVM2Global::createObject()
+{
+ return new as_object;
+}
+
+as_object*
+AVM2Global::createObject(as_object* prototype)
+{
+ return new as_object(prototype);
+}
builtin_function*
AVM2Global::createFunction(Global_as::ASFunction function)
=== modified file 'libcore/asobj/Globals.h'
--- a/libcore/asobj/Globals.h 2009-07-14 15:33:46 +0000
+++ b/libcore/asobj/Globals.h 2009-07-16 12:46:26 +0000
@@ -72,6 +72,10 @@
virtual as_object* createBoolean(bool b);
+ virtual as_object* createObject();
+
+ virtual as_object* createObject(as_object* prototype);
+
virtual const ClassHierarchy& classHierarchy() const {
return _classes;
}
@@ -134,6 +138,10 @@
virtual as_object* createBoolean(bool b);
+ virtual as_object* createObject();
+
+ virtual as_object* createObject(as_object* prototype);
+
virtual const ClassHierarchy& classHierarchy() const {
return _classes;
}
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp 2009-07-15 09:09:52 +0000
+++ b/libcore/movie_root.cpp 2009-07-16 13:13:56 +0000
@@ -1007,14 +1007,16 @@
bool
movie_root::advance()
{
- unsigned int now = _vm.getTime();
+ // We can't actually rely on now being later than _lastMovieAdvancement,
+ // so we will have to check. Otherwise we risk elapsed being
+ // contructed from a negative value.
+ const size_t now = std::max<size_t>(_vm.getTime(),
_lastMovieAdvancement);
bool advanced = false;
try {
- assert(now >= _lastMovieAdvancement);
- size_t elapsed = now - _lastMovieAdvancement;
+ const size_t elapsed = now - _lastMovieAdvancement;
if (elapsed >= _movieAdvancementDelay)
{
advanced = true;
@@ -1085,7 +1087,7 @@
movie_root::timeToNextFrame() const
{
unsigned int now = _vm.getTime();
- int elapsed = now - _lastMovieAdvancement;
+ const int elapsed = now - _lastMovieAdvancement;
return _movieAdvancementDelay - elapsed;
}
@@ -1771,8 +1773,8 @@
}
else
{
- unsigned long elapsed;
- if ( timer->expired(now, elapsed) )
+ size_t elapsed;
+ if (timer->expired(now, elapsed))
{
expiredTimers.insert( std::make_pair(elapsed,
timer) );
}
=== modified file 'libcore/vm/CallStack.cpp'
--- a/libcore/vm/CallStack.cpp 2009-01-22 20:10:39 +0000
+++ b/libcore/vm/CallStack.cpp 2009-07-16 12:56:51 +0000
@@ -17,13 +17,14 @@
//
#include "CallStack.h"
#include "as_object.h"
-#include "as_function.h" // for
as_environment::CallFrame::markReachableResources
+#include "as_function.h"
+#include "Global_as.h"
namespace gnash {
CallFrame::CallFrame(as_function* funcPtr)
:
- locals(new as_object()),
+ locals(getGlobal(*funcPtr)->createObject()),
func(funcPtr)
{
}
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp 2009-07-14 15:33:46 +0000
+++ b/libcore/vm/Machine.cpp 2009-07-16 12:56:51 +0000
@@ -863,7 +863,7 @@
log_aserror(_("Can't push a null value onto the "
"scope stack (%s)."), scope_value);
);
- scope_value = as_value(new as_object());
+ scope_value = as_value(_global->createObject());
}
push_scope_stack(scope_value);
break;
@@ -1607,7 +1607,7 @@
/// NB: This builds an object from its properties, it's not a
constructor.
case SWF::ABC_ACTION_NEWOBJECT:
{
- as_object *obj = new as_object(getObjectInterface());
+ as_object *obj =
_global->createObject(getObjectInterface());
boost::uint32_t argc = mStream->read_V32();
int i = argc;
while (i--)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11270: Fix an assertion failure I added to check a signed/unsigned comparison.,
Benjamin Wolsey <=