diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-08-07 09:03:41 +0200 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-08-07 09:06:00 +0200 |
commit | ef7b382efc1eeb0edd4358be5ad8e4864ae14cc5 (patch) | |
tree | da5d7f3c32ab955d287f3843af28024d31b73dc7 /sd | |
parent | a554b8e38fd5f4d1b613344304e012c9abc3c870 (diff) |
Fixed segfault on client exit.
Change-Id: I802551094e0cae2a4e1709723f0fc1661ba32af5
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/remotecontrol/Server.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Transmitter.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Transmitter.hxx | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx index 1550b579dc82..9be7f2b3d515 100644 --- a/sd/source/ui/remotecontrol/Server.cxx +++ b/sd/source/ui/remotecontrol/Server.cxx @@ -90,7 +90,8 @@ void RemoteServer::listenThread() // TODO: deal with transmision errors gracefully. presentationStopped(); - delete pTransmitter; + pTransmitter->notifyFinished(); + pTransmitter->join(); pTransmitter = NULL; fprintf( stderr, "Finished listening\n" ); } diff --git a/sd/source/ui/remotecontrol/Transmitter.cxx b/sd/source/ui/remotecontrol/Transmitter.cxx index ef58097fb8f6..209e46039f40 100644 --- a/sd/source/ui/remotecontrol/Transmitter.cxx +++ b/sd/source/ui/remotecontrol/Transmitter.cxx @@ -17,6 +17,7 @@ Transmitter::Transmitter( StreamSocket &aSocket ) : Thread( "TransmitterThread" ), mStreamSocket( aSocket ), mQueuesNotEmpty(), + mFinishRequested(), mQueueMutex(), mLowPriority(), mHighPriority() @@ -29,6 +30,9 @@ void Transmitter::execute() { mQueuesNotEmpty.wait(); + if ( mFinishRequested.check() ) + return; + ::osl::MutexGuard aQueueGuard( mQueueMutex ); if ( !mHighPriority.empty() ) { @@ -51,6 +55,12 @@ void Transmitter::execute() } +void Transmitter::notifyFinished() +{ + mFinishRequested.set(); + mQueuesNotEmpty.set(); +} + Transmitter::~Transmitter() { diff --git a/sd/source/ui/remotecontrol/Transmitter.hxx b/sd/source/ui/remotecontrol/Transmitter.hxx index b042454ca494..1b83458b04cc 100644 --- a/sd/source/ui/remotecontrol/Transmitter.hxx +++ b/sd/source/ui/remotecontrol/Transmitter.hxx @@ -28,6 +28,7 @@ public: Transmitter( osl::StreamSocket &aSocket ); ~Transmitter(); void addMessage( const rtl::OString& aMessage, const Priority aPriority ); + void notifyFinished(); private: void execute(); @@ -35,6 +36,7 @@ private: ::osl::StreamSocket mStreamSocket; ::osl::Condition mQueuesNotEmpty; + ::osl::Condition mFinishRequested; ::osl::Mutex mQueueMutex; |