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

loplugin:useuniqueptr in sd::Communicator

Change-Id: If4725a7c170a4f10b1ffd0cfc769fcdca70e2eaf
Reviewed-on: https://gerrit.libreoffice.org/56493
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7e2240c3
......@@ -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 );
}
}
......
......@@ -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;
};
}
......
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