sd/source/ui/remotecontrol/Listener.cxx | 10 +++++++--- sd/source/ui/remotecontrol/Server.cxx | 7 ++++--- sd/source/ui/remotecontrol/Transmitter.cxx | 5 ++++- 3 files changed, 15 insertions(+), 7 deletions(-)
New commits: commit 55925e0944922a638d0b10615f520b7db0a50d68 Author: Andrzej J. R. Hunt <andr...@ahunt.org> Date: Thu Jul 19 11:00:47 2012 +0200 Finally fixed the Transmitter bug. Change-Id: Ia4c345b9ecb58a47219ceb0af14b66294ca3309e diff --git a/sd/source/ui/remotecontrol/Listener.cxx b/sd/source/ui/remotecontrol/Listener.cxx index a21977e..7b607ab 100644 --- a/sd/source/ui/remotecontrol/Listener.cxx +++ b/sd/source/ui/remotecontrol/Listener.cxx @@ -23,9 +23,12 @@ using rtl::OStringBuffer; Listener::Listener( sd::Transmitter *aTransmitter ) - : ::cppu::WeakComponentImplHelper1< XSlideShowListener>( m_aMutex ) + : ::cppu::WeakComponentImplHelper1< XSlideShowListener >( m_aMutex ), + pTransmitter( NULL ) { + fprintf( stderr, "listener:: address of Transmitter1:%p\n", aTransmitter ); pTransmitter = aTransmitter; + fprintf( stderr, "listener:: address of Transmitter2:%p\n", pTransmitter ); } Listener::~Listener() @@ -37,7 +40,7 @@ void Listener::init( const css::uno::Reference< css::presentation::XSlideShowCon if (aController.is() ) { mController = css::uno::Reference< css::presentation::XSlideShowController >( aController ); - aController->addSlideShowListener(this); + aController->addSlideShowListener( this ); fprintf( stderr, "Registered listener.\n" ); } } @@ -80,6 +83,7 @@ void SAL_CALL Listener::resumed (void) void SAL_CALL Listener::slideEnded (sal_Bool bReverse) throw (css::uno::RuntimeException) { + fprintf( stderr, "listener:: address of Transmitter__:%p\n", pTransmitter ); fprintf( stderr, "slideEnded\n" ); (void) bReverse; sal_Int32 aSlide = mController->getCurrentSlideIndex(); @@ -125,7 +129,7 @@ void SAL_CALL Listener::disposing (void) pTransmitter = NULL; if ( mController.is() ) { - mController->removeSlideShowListener( static_cast<XSlideShowListener*>(this) ); + mController->removeSlideShowListener( this ); } } diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx index 8ed3b70..2906f6c 100644 --- a/sd/source/ui/remotecontrol/Server.cxx +++ b/sd/source/ui/remotecontrol/Server.cxx @@ -35,9 +35,11 @@ Server::~Server() // Run as a thread void Server::listenThread() { + fprintf( stderr, "Server:: address of Transmitter before:%p\n", pTransmitter ); pTransmitter = new Transmitter( mStreamSocket ); pTransmitter->launch(); Receiver aReceiver( pTransmitter ); + fprintf( stderr, "Server:: address of Transmitter:%p\n", pTransmitter ); // aTransmitter.addMessage( "Hello world\n\n", Transmitter::Priority::HIGH ); try { fprintf( stderr, "Trying to add a Listener in listenThread\n" ); @@ -75,14 +77,13 @@ void Server::listenThread() aRet = mStreamSocket.recv( &aBuffer[aRead], 100 ); if ( aRet == 0 ) { - return; // closed + break; // I.e. transmission finished. } aRead += aRet; vector<char>::iterator aIt; - while ( (aIt = find( aBuffer.begin() + aRead - aRet, aBuffer.end(), '\n' )) + while ( (aIt = find( aBuffer.begin(), aBuffer.end(), '\n' )) != aBuffer.end() ) { - fprintf( stderr, "we have string\n" ); sal_uInt64 aLocation = aIt - aBuffer.begin(); aCommand.push_back( OString( &(*aBuffer.begin()), aLocation ) ); diff --git a/sd/source/ui/remotecontrol/Transmitter.cxx b/sd/source/ui/remotecontrol/Transmitter.cxx index d7cfda0..efece0f 100644 --- a/sd/source/ui/remotecontrol/Transmitter.cxx +++ b/sd/source/ui/remotecontrol/Transmitter.cxx @@ -21,13 +21,15 @@ Transmitter::Transmitter( StreamSocket &aSocket ) mLowPriority(), mHighPriority() { + fprintf( stderr, "Address of low queue in constructor:%p\n", &mLowPriority ); } void Transmitter::execute() { fprintf( stderr, "Waiting\n" ); - while( mQueuesNotEmpty.wait() ) + while ( true ) { + mQueuesNotEmpty.wait(); fprintf( stderr, "Continuing after condition\n" ); while ( true ) { @@ -71,6 +73,7 @@ void Transmitter::addMessage( const OString& aMessage, const Priority aPriority fprintf(stderr, "Acquiring\n"); ::osl::MutexGuard aQueueGuard( mQueueMutex ); fprintf(stderr, "Acquired\n" ); + fprintf( stderr, "Address of low queue in addMessge:%p\n", &mLowPriority ); switch ( aPriority ) { case Priority::LOW: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits