summaryrefslogtreecommitdiff
path: root/sd/source/ui/remotecontrol/BluetoothServer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/remotecontrol/BluetoothServer.cxx')
-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;
}
}