From: Johnathan G. <da...@us...> - 2003-08-22 17:44:27
|
daren 2003/08/22 10:44:25 PDT Modified files: metropolis SConstruct metropolis/src/python SConscript converters.in entityTest.py loadConverters.py metropolis-converters.h metropolis.pyste metropolis/src/reality World.cpp World.h Log: - Modified the build system to default to a debug build; specify the optimize option to get it to optimize. - Modified the World Class to contain a cleanup function. This is going to be a serious problem. Basically, a Singleton is static, and therefore the time at which its destructor is called relative to everything else is undefined. Apparently, the python interpreter is COMPLETELY shutdown before the singleton's are deallocated. This is a problem because of shared_ptrs. The shared ptrs reference count is incremented and decremented for both C++ and Python. When the python interpreter is shutdown, it checks the reference count and sees that it's more than one, so it won't delete the object. However, it still proceeds to shutdown the main python threads (it has no choice; the interpreter is closing). This is a problem when the shared_ptr points to something that exists in python's memory, because when the C++ side cleans up, it decrements the shared_ptrs reference count to zero, and then attempts to delete it, which causes an abort, because the python interpreter is already closed, so any attempt to access it results in an exception being thrown. A potential solution to this problem is in Modern CPP Desin's Singleton with Lifetime Policies. Revision Changes Path 1.3 +5 -5 darenland/metropolis/SConstruct 1.3 +1 -0 darenland/metropolis/src/python/SConscript 1.2 +1 -0 darenland/metropolis/src/python/converters.in 1.4 +1 -0 darenland/metropolis/src/python/entityTest.py 1.2 +1 -1 darenland/metropolis/src/python/loadConverters.py 1.2 +25 -0 darenland/metropolis/src/python/metropolis-converters.h 1.3 +1 -0 darenland/metropolis/src/python/metropolis.pyste 1.5 +10 -0 darenland/metropolis/src/reality/World.cpp 1.4 +17 -0 darenland/metropolis/src/reality/World.h http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/isugamedev/darenland/metropolis/SConstruct.diff?r1=1.2&r2=1.3&diff_format=h http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/isugamedev/darenland/metropolis/src/python/SConscript.diff?r1=1.2&r2=1.3&diff_format=h http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/isugamedev/darenland/metropolis/src/python/converters.in.diff?r1=1.1&r2=1.2&diff_format=h http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/isugamedev/darenland/metropolis/src/python/entityTest.py.diff?r1=1.3&r2=1.4&diff_format=h http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/isugamedev/darenland/metropolis/src/python/loadConverters.py.diff?r1=1.1&r2=1.2&diff_format=h http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/isugamedev/darenland/metropolis/src/python/metropolis-converters.h.diff?r1=1.1&r2=1.2&diff_format=h http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/isugamedev/darenland/metropolis/src/python/metropolis.pyste.diff?r1=1.2&r2=1.3&diff_format=h http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/isugamedev/darenland/metropolis/src/reality/World.cpp.diff?r1=1.4&r2=1.5&diff_format=h http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/isugamedev/darenland/metropolis/src/reality/World.h.diff?r1=1.3&r2=1.4&diff_format=h |