pyuno/source/module/pyuno_gc.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 639419601a3730eb84d0922ef3a540c961b81910
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Jan 7 11:21:31 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Jan 7 14:30:30 2022 +0100

    tdf#146621: handle an exception that may hang process at ExitProcess time
    
    Change-Id: I3ffc2303ae1851ab909612ae9bb7f70a077b24fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128097
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/pyuno/source/module/pyuno_gc.cxx b/pyuno/source/module/pyuno_gc.cxx
index e4ed6cb9d0a6..1efca400d510 100644
--- a/pyuno/source/module/pyuno_gc.cxx
+++ b/pyuno/source/module/pyuno_gc.cxx
@@ -111,11 +111,20 @@ void decreaseRefCount( PyInterpreterState *interpreter, 
PyObject *object )
     // to be a method, which tells, whether the global
     // interpreter lock is held or not
     // TODO: Look for a more efficient solution
-    rtl::Reference< GCThread >(new GCThread(interpreter, object))->launch();
+    try
+    {
+        rtl::Reference< GCThread >(new GCThread(interpreter, 
object))->launch();
         //TODO: a protocol is missing how to join with the launched thread
         // before exit(3), to ensure the thread is no longer relying on any
         // infrastructure while that infrastructure is being shut down in
         // atexit handlers
+    }
+    catch (std::runtime_error&)
+    {
+        // tdf#146621: Thread creation will fail on Windows with 
ERROR_ACCESS_DENIED
+        // when called at ExitProcess time; unhandled exception would hang the 
process
+        abort();
+    }
 }
 
 }

Reply via email to