summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-01-08 09:27:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-01-08 10:18:14 +0100
commit638be04c8334e5e29f9258ff870fbe63603ce7e0 (patch)
treed83604fa0abc28696657f37a6c797183ca160d6f
parent7a26512fdbef282e77028f0f318faf72b11190ee (diff)
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@collabora.co.uk>
-rw-r--r--sd/source/ui/remotecontrol/BluetoothServer.cxx11
1 files changed, 4 insertions, 7 deletions
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;
}
}