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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 8 09:18:39 UTC 2019


 sd/source/ui/remotecontrol/BluetoothServer.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 638be04c8334e5e29f9258ff870fbe63603ce7e0
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jan 8 09:27:11 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jan 8 10:18:14 2019 +0100

    use unique_ptr in sd::BluetoothServer::Impl
    
    Change-Id: I54bd8fbac488182d2017e90b7afced2659f01728
    Reviewed-on: https://gerrit.libreoffice.org/65955
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index f614af007e78..170a2f08396d 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -90,14 +90,13 @@ struct sd::BluetoothServer::Impl {
     // the glib mainloop running in the thread
     GMainContext *mpContext;
     DBusConnection *mpConnection;
-    DBusObject *mpService;
+    std::unique_ptr<DBusObject> mpService;
     enum class BluezVersion { BLUEZ4, BLUEZ5, UNKNOWN };
     BluezVersion maBluezVersion;
 
     Impl()
         : mpContext( g_main_context_new() )
         , mpConnection( nullptr )
-        , mpService( nullptr )
         , maBluezVersion( BluezVersion::UNKNOWN )
     { }
 
@@ -853,17 +852,15 @@ setDiscoverable( DBusConnection *pConnection, DBusObject *pAdapter, bool bDiscov
     }
 }
 
-static DBusObject *
+static std::unique_ptr<DBusObject>
 registerWithDefaultAdapter( DBusConnection *pConnection )
 {
-    DBusObject *pService;
-    pService = bluez4GetDefaultService( pConnection );
+    std::unique_ptr<DBusObject> pService(bluez4GetDefaultService( pConnection ));
     if( pService )
     {
-        if( !bluez4RegisterServiceRecord( pConnection, pService,
+        if( !bluez4RegisterServiceRecord( pConnection, pService.get(),
                                      bluetooth_service_record ) )
         {
-            delete pService;
             return nullptr;
         }
     }


More information about the Libreoffice-commits mailing list