diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2005-02-11 15:40:27 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2005-02-11 15:40:27 +0000 |
commit | b1f5e77fe8f9aa2006d66cb51fac582a9f0e14a6 (patch) | |
tree | 49d21b31cf854099aa7ea8bca7f62f7e62686328 /pyuno/source/module/pyuno_gc.cxx | |
parent | 12f822855a9d33e034a139ddc4e0db10d7ce6abc (diff) |
INTEGRATION: CWS pyunofixes1 (1.2.24); FILE MERGED
2005/01/19 23:13:26 jbu 1.2.24.1: #i37468# reduced liklyhood of crashing after main with extra checks
Diffstat (limited to 'pyuno/source/module/pyuno_gc.cxx')
-rw-r--r-- | pyuno/source/module/pyuno_gc.cxx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/pyuno/source/module/pyuno_gc.cxx b/pyuno/source/module/pyuno_gc.cxx index e7f114761..7d2782067 100644 --- a/pyuno/source/module/pyuno_gc.cxx +++ b/pyuno/source/module/pyuno_gc.cxx @@ -2,9 +2,9 @@ * * $RCSfile: pyuno_gc.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: hr $ $Date: 2004-02-02 19:30:09 $ + * last change: $Author: hr $ $Date: 2005-02-11 16:40:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,16 @@ namespace pyuno { +bool g_destructorsOfStaticObjectsHaveBeenCalled; +class StaticDestructorGuard +{ +public: + ~StaticDestructorGuard() + { + g_destructorsOfStaticObjectsHaveBeenCalled = true; + } +}; +StaticDestructorGuard guard; class GCThread : public ::osl::Thread { @@ -84,6 +94,9 @@ GCThread::GCThread( PyInterpreterState *interpreter, PyObject * object ) : void GCThread::run() { + // otherwise we crash here, when main has been left already + if( g_destructorsOfStaticObjectsHaveBeenCalled ) + return; try { PyThreadAttach guard( (PyInterpreterState*)mPyInterpreter ); @@ -117,6 +130,10 @@ void GCThread::onTerminated() void decreaseRefCount( PyInterpreterState *interpreter, PyObject *object ) { + // otherwise we crash in the last after main ... + if( g_destructorsOfStaticObjectsHaveBeenCalled ) + return; + // delegate to a new thread, because there does not seem // to be a method, which tells, whether the global // interpreter lock is held or not |