[Libreoffice-commits] core.git: shell/source

Stephan Bergmann sbergman at redhat.com
Tue Jan 19 01:40:42 PST 2016


 shell/source/sessioninstall/SyncDbusSessionHelper.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 21f98618d8cd7562d423e94db988126d662165c9
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 19 10:37:55 2016 +0100

    -Werror=terminate (GCC 6)
    
    ...when throwing an exception from implicitly noexcept ~GErrorWrapper.  So make
    ~GErrorWrapper noexcept(false) and see that no code executed while a
    GErrorWrapper instance is active on the stack would throw an exception.  But the
    design of GErrorWrapper, to throw an exception from a dtor, is very brittle and
    should be fixed.
    
    Change-Id: Ib04ff2b0497c160dc7ee44c3354fa9619285ec88

diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx
index d0c1b30..eca1a4b 100644
--- a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx
+++ b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx
@@ -26,7 +26,7 @@ namespace
         GError* m_pError;
         public:
             explicit GErrorWrapper(GError* pError) : m_pError(pError) {}
-            ~GErrorWrapper()
+            ~GErrorWrapper() noexcept(false)
             {
                 if(!m_pError)
                     return;
@@ -39,15 +39,17 @@ namespace
     static inline GDBusProxy* lcl_GetPackageKitProxy(const OUString& sInterface)
     {
         const OString sFullInterface = OUStringToOString("org.freedesktop.PackageKit." + sInterface, RTL_TEXTENCODING_ASCII_US);
-        GErrorWrapper error(nullptr);
         GDBusProxy* proxy = nullptr;
-        proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+        {
+            GErrorWrapper error(nullptr);
+            proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
                                G_DBUS_PROXY_FLAGS_NONE, nullptr,
                                "org.freedesktop.PackageKit",
                                "/org/freedesktop/PackageKit",
                                reinterpret_cast<const gchar*>(sFullInterface.getStr()),
                                nullptr,
                                &error.getRef());
+        }
         if(!proxy)
             throw RuntimeException("couldnt get a proxy!");
         return proxy;


More information about the Libreoffice-commits mailing list