salhelper/source/thread.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 47cdd3ba605324072db617c6ae2d1a647b8bdce6
Author:     Noel Grandin <n...@peralex.com>
AuthorDate: Wed Dec 1 09:57:16 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Dec 1 13:04:17 2021 +0100

    revert part of "remove counter-productive catch-all blocks"
    
    as sberg points out, this rethrow will not necessarily crash
    the process
    
    Change-Id: I0ced6c102d1c0c1bf680b0903fcb232cc891bf92
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126167
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/salhelper/source/thread.cxx b/salhelper/source/thread.cxx
index 3d9c4b372005..190daf5081b6 100644
--- a/salhelper/source/thread.cxx
+++ b/salhelper/source/thread.cxx
@@ -22,8 +22,13 @@ void salhelper::Thread::launch() {
     // Assumption is that osl::Thread::create returns normally with a true
     // return value iff it causes osl::Thread::run to start executing:
     acquire();
-    if (!create()) {
-        throw std::runtime_error("osl::Thread::create failed");
+    try {
+        if (!create()) {
+            throw std::runtime_error("osl::Thread::create failed");
+        }
+    } catch (...) {
+        release();
+        throw;
     }
 }
 

Reply via email to