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

Noel Grandin noel.grandin at collabora.co.uk
Wed Jun 27 07:54:49 UTC 2018


 sd/source/ui/remotecontrol/Communicator.cxx |    9 ++++-----
 sd/source/ui/remotecontrol/Communicator.hxx |    5 +++--
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit bd1ffb2de9f58bad78f4c96c0017d13e24761a0b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jun 25 16:49:30 2018 +0200

    loplugin:useuniqueptr in sd::Communicator
    
    Change-Id: If4725a7c170a4f10b1ffd0cfc769fcdca70e2eaf
    Reviewed-on: https://gerrit.libreoffice.org/56493
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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;
     };
 }


More information about the Libreoffice-commits mailing list