[Libreoffice-commits] .: sd/source
Andrzej J.R. Hunt
ajrhunt at kemper.freedesktop.org
Tue Aug 7 00:06:39 PDT 2012
sd/source/ui/remotecontrol/Server.cxx | 3 ++-
sd/source/ui/remotecontrol/Transmitter.cxx | 10 ++++++++++
sd/source/ui/remotecontrol/Transmitter.hxx | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)
New commits:
commit ef7b382efc1eeb0edd4358be5ad8e4864ae14cc5
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Tue Aug 7 09:03:41 2012 +0200
Fixed segfault on client exit.
Change-Id: I802551094e0cae2a4e1709723f0fc1661ba32af5
diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx
index 1550b57..9be7f2b 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 ef58097..209e460 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 b042454..1b83458 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;
More information about the Libreoffice-commits
mailing list