diff options
author | Caolán McNamara <cmc@openoffice.org> | 2009-10-17 13:09:10 +0000 |
---|---|---|
committer | Caolán McNamara <cmc@openoffice.org> | 2009-10-17 13:09:10 +0000 |
commit | 327de52e632adab8cacfcd7ad353ee63db32cbbc (patch) | |
tree | d3dfd5f06ca7c0f8d8b15876399d625ce684e897 /pyuno | |
parent | 3198101b113b3d55a07813a562ea01a15ff15923 (diff) |
#i105919# avoid crash after python deinitialized post exit
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/source/module/pyuno_gc.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pyuno/source/module/pyuno_gc.cxx b/pyuno/source/module/pyuno_gc.cxx index 513c14a99378..1e0ca08ff954 100644 --- a/pyuno/source/module/pyuno_gc.cxx +++ b/pyuno/source/module/pyuno_gc.cxx @@ -43,6 +43,12 @@ public: }; StaticDestructorGuard guard; +static bool isAfterUnloadOrPy_Finalize() +{ + return g_destructorsOfStaticObjectsHaveBeenCalled || + !Py_IsInitialized(); +} + class GCThread : public ::osl::Thread { PyObject *mPyObject; @@ -64,7 +70,7 @@ GCThread::GCThread( PyInterpreterState *interpreter, PyObject * object ) : void GCThread::run() { // otherwise we crash here, when main has been left already - if( g_destructorsOfStaticObjectsHaveBeenCalled ) + if( isAfterUnloadOrPy_Finalize() ) return; try { @@ -100,7 +106,7 @@ void GCThread::onTerminated() void decreaseRefCount( PyInterpreterState *interpreter, PyObject *object ) { // otherwise we crash in the last after main ... - if( g_destructorsOfStaticObjectsHaveBeenCalled ) + if( isAfterUnloadOrPy_Finalize() ) return; // delegate to a new thread, because there does not seem |