Kaydet (Commit) 638be04c authored tarafından Noel Grandin's avatar Noel Grandin

use unique_ptr in sd::BluetoothServer::Impl

Change-Id: I54bd8fbac488182d2017e90b7afced2659f01728
Reviewed-on: https://gerrit.libreoffice.org/65955
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7a26512f
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment