diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-25 16:49:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-27 09:54:26 +0200 |
commit | bd1ffb2de9f58bad78f4c96c0017d13e24761a0b (patch) | |
tree | 537d9479bdcd08c1e3766a30b84c08c8e67683fe /sd | |
parent | 7e2240c384c405bb14207f0cb26bff3e4357fcb6 (diff) |
loplugin:useuniqueptr in sd::Communicator
Change-Id: If4725a7c170a4f10b1ffd0cfc769fcdca70e2eaf
Reviewed-on: https://gerrit.libreoffice.org/56493
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/remotecontrol/Communicator.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Communicator.hxx | 5 |
2 files changed, 7 insertions, 7 deletions
diff --git a/sd/source/ui/remotecontrol/Communicator.cxx b/sd/source/ui/remotecontrol/Communicator.cxx index a0a27affab38..4309edaff066 100644 --- a/sd/source/ui/remotecontrol/Communicator.cxx +++ b/sd/source/ui/remotecontrol/Communicator.cxx @@ -51,7 +51,7 @@ void Communicator::forceClose() // Run as a thread void Communicator::execute() { - pTransmitter = new Transmitter( mpSocket ); + pTransmitter.reset( new Transmitter( mpSocket.get() ) ); pTransmitter->create(); pTransmitter->addMessage( "LO_SERVER_SERVER_PAIRED\n\n", @@ -62,7 +62,7 @@ void Communicator::execute() pTransmitter->addMessage( aServerInformationBuffer.makeStringAndClear(), Transmitter::PRIORITY_HIGH ); - Receiver aReceiver( pTransmitter ); + Receiver aReceiver( pTransmitter.get() ); try { uno::Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( ::comphelper::getProcessComponentContext() ); uno::Reference< frame::XFrame > xFrame ( xFramesSupplier->getActiveFrame(), uno::UNO_QUERY ); @@ -125,8 +125,7 @@ void Communicator::execute() pTransmitter = nullptr; mpSocket->close(); - delete mpSocket; - mpSocket = nullptr; + mpSocket.reset(); RemoteServer::removeCommunicator( this ); } @@ -144,7 +143,7 @@ void Communicator::presentationStarted( const css::uno::Reference< { if ( pTransmitter ) { - mListener.set( new Listener( this, pTransmitter ) ); + mListener.set( new Listener( this, pTransmitter.get() ) ); mListener->init( rController ); } } diff --git a/sd/source/ui/remotecontrol/Communicator.hxx b/sd/source/ui/remotecontrol/Communicator.hxx index cca2ea2a982a..893dab2a1367 100644 --- a/sd/source/ui/remotecontrol/Communicator.hxx +++ b/sd/source/ui/remotecontrol/Communicator.hxx @@ -14,6 +14,7 @@ #include <unistd.h> #endif #include <sys/types.h> +#include <memory> #include <vector> #include <rtl/ref.hxx> @@ -49,9 +50,9 @@ namespace sd private: void execute() override; - IBluetoothSocket *mpSocket; + std::unique_ptr<IBluetoothSocket> mpSocket; - Transmitter *pTransmitter; + std::unique_ptr<Transmitter> pTransmitter; rtl::Reference<Listener> mListener; }; } |