summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Steckelmacher <steckdenis@yahoo.fr>2011-08-19 17:25:30 +0200
committerDenis Steckelmacher <steckdenis@yahoo.fr>2011-08-19 17:25:30 +0200
commitc8829488fd5d46d8cf5a35f9aa9dc5820bd89abb (patch)
tree663c8e9706281817a8152be9e2887e13238883f0
parent89b835febf6836c517a5890a4e371afed7a173d6 (diff)
Apply a patch from Tom Stellard fixing a crash on GCC 4.6.
-rw-r--r--src/core/object.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/object.cpp b/src/core/object.cpp
index 43c5bec..4fd7eb1 100644
--- a/src/core/object.cpp
+++ b/src/core/object.cpp
@@ -34,7 +34,12 @@
using namespace Coal;
-std::list<Object *> known_objects;
+static std::list<Object *>& getKnownObjects()
+{
+ static std::list<Object *> known_objects;
+ return known_objects;
+}
+
Object::Object(Type type, Object *parent)
: p_references(1), p_parent(parent), p_type(type), p_release_parent(true)
@@ -43,8 +48,8 @@ Object::Object(Type type, Object *parent)
parent->reference();
// Add object in the list of known objects
- known_objects.push_front(this);
- p_it = known_objects.begin();
+ getKnownObjects().push_front(this);
+ p_it = getKnownObjects().begin();
}
Object::~Object()
@@ -53,7 +58,7 @@ Object::~Object()
delete p_parent;
// Remove object from the list of known objects
- known_objects.erase(p_it);
+ getKnownObjects().erase(p_it);
}
void Object::reference()
@@ -94,8 +99,8 @@ bool Object::isA(Object::Type type) const
return false;
// Check that the value isn't garbage or freed pointer
- std::list<Object *>::const_iterator it = known_objects.begin(),
- e = known_objects.end();
+ std::list<Object *>::const_iterator it = getKnownObjects().begin(),
+ e = getKnownObjects().end();
while (it != e)
{
if (*it == this)