comphelper/source/misc/asyncnotification.cxx |   18 ++++--------------
 salhelper/source/thread.cxx                  |   20 ++++----------------
 2 files changed, 8 insertions(+), 30 deletions(-)

New commits:
commit 6bc5d6cac2fd9e029357c618510a3b5f3aa7c085
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Nov 28 18:32:59 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Nov 29 09:58:43 2021 +0100

    remove counter-productive catch-all blocks
    
    There is no point in these - the rethrow will crash the process
    anyway, so trying to recover anything is a waste of time.
    
    And they very unhelpfully obscure the stacktrace of the actual
    underlying problem.
    
    Change-Id: I8e4439e5e2c517aa80a1750a05c207d274c73012
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125980
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/comphelper/source/misc/asyncnotification.cxx 
b/comphelper/source/misc/asyncnotification.cxx
index e498ce23ba44..e2c5691899d3 100644
--- a/comphelper/source/misc/asyncnotification.cxx
+++ b/comphelper/source/misc/asyncnotification.cxx
@@ -231,26 +231,16 @@ namespace comphelper
     {
         // see salhelper::Thread::launch
         xThis->m_xImpl->pKeepThisAlive = xThis;
-        try {
-            if (!xThis->create()) {
-                throw std::runtime_error("osl::Thread::create failed");
-            }
-        } catch (...) {
-            xThis->m_xImpl->pKeepThisAlive.reset();
-            throw;
+        if (!xThis->create()) {
+            throw std::runtime_error("osl::Thread::create failed");
         }
     }
 
     void AsyncEventNotifierAutoJoin::run()
     {
         // see salhelper::Thread::run
-        try {
-            setName(m_xImpl->name);
-            execute();
-        } catch (...) {
-            onTerminated();
-            throw;
-        }
+        setName(m_xImpl->name);
+        execute();
     }
 
     void AsyncEventNotifierAutoJoin::onTerminated()
diff --git a/salhelper/source/thread.cxx b/salhelper/source/thread.cxx
index 1a06bf3b235a..3d9c4b372005 100644
--- a/salhelper/source/thread.cxx
+++ b/salhelper/source/thread.cxx
@@ -22,28 +22,16 @@ 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();
-    try {
-        if (!create()) {
-            throw std::runtime_error("osl::Thread::create failed");
-        }
-    } catch (...) {
-        release();
-        throw;
+    if (!create()) {
+        throw std::runtime_error("osl::Thread::create failed");
     }
 }
 
 salhelper::Thread::~Thread() {}
 
 void salhelper::Thread::run() {
-    try {
-        setName(name_);
-        execute();
-    } catch (...) {
-        // Work around the problem that onTerminated is not called if run 
throws
-        // an exception:
-        onTerminated();
-        throw;
-    }
+    setName(name_);
+    execute();
 }
 
 void salhelper::Thread::onTerminated() { release(); }

Reply via email to