diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-07-28 20:00:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-04 18:49:48 +0200 |
commit | ce2792eda318b2760d24d2a744fc89e6a1d87138 (patch) | |
tree | 55ee0998313380481b566c5ff9874f02d5ea5308 /vcl | |
parent | f9309a171a762b888bdfbea1dba8cbc1683be089 (diff) |
use C++11 exception rethrowing
for those cases where we are doing relatively simple catching and rethrowing
e.g. catch in one thread and throw in main thread.
Change-Id: I6192017c4ec99dd671a9582f7b004096b0fc4525
Reviewed-on: https://gerrit.libreoffice.org/58588
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtkdata.hxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkdata.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkframe.cxx | 19 |
3 files changed, 6 insertions, 21 deletions
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 31440f0f3655..14330d70fb9e 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -100,7 +100,7 @@ class GtkSalData : public GenericUnixSalData GSource* m_pUserEvent; osl::Mutex m_aDispatchMutex; osl::Condition m_aDispatchCondition; - css::uno::Any m_aException; + std::exception_ptr m_aException; css::uno::Reference<css::accessibility::XAccessibleEventListener> m_xDocumentFocusListener; DocumentFocusListener * m_pDocumentFocusListener; @@ -127,7 +127,7 @@ public: virtual bool ErrorTrapPop( bool bIgnoreError = true ) override; inline GtkSalDisplay *GetGtkDisplay() const; - void setException(const css::uno::Any& rException) { m_aException = rException; } + void setException(const std::exception_ptr& exception) { m_aException = exception; } }; class GtkSalFrame; diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx index 030e922ae101..48047240e643 100644 --- a/vcl/unx/gtk3/gtk3gtkdata.cxx +++ b/vcl/unx/gtk3/gtk3gtkdata.cxx @@ -464,8 +464,8 @@ bool GtkSalData::Yield( bool bWait, bool bHandleAllCurrentEvents ) if( wasOneEvent ) bWasEvent = true; } - if (m_aException.hasValue()) - ::cppu::throwException(m_aException); + if (m_aException) + std::rethrow_exception(m_aException); } else if( bWait ) { diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 1791b82ac4f8..17659c3744fc 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -4482,25 +4482,10 @@ bool GtkSalFrame::CallCallbackExc(SalEvent nEvent, const void* pEvent) const { nRet = CallCallback(nEvent, pEvent); } - catch (const css::uno::Exception&) - { - auto e = cppu::getCaughtException(); - GtkSalData *pSalData = static_cast<GtkSalData*>(GetSalData()); - pSalData->setException(e); - } - catch (std::exception & e) - { - static_cast<GtkSalData *>(GetSalData())->setException( - css::uno::Any( - css::uno::RuntimeException( - "wrapped std::exception " - + o3tl::runtimeToOUString(e.what())))); - } catch (...) { - static_cast<GtkSalData *>(GetSalData())->setException( - css::uno::Any( - css::uno::RuntimeException("wrapped unknown exception"))); + GtkSalData *pSalData = static_cast<GtkSalData*>(GetSalData()); + pSalData->setException(std::current_exception()); } return nRet; } |