sd/source/ui/inc/Server.hxx | 4 ++-- sd/source/ui/remotecontrol/Listener.cxx | 16 ++++++++-------- sd/source/ui/remotecontrol/Listener.hxx | 2 +- sd/source/ui/remotecontrol/Receiver.cxx | 2 +- sd/source/ui/remotecontrol/Receiver.hxx | 2 +- sd/source/ui/remotecontrol/Server.cxx | 18 ++++++++---------- sd/source/ui/remotecontrol/Transmitter.cxx | 9 ++++----- sd/source/ui/remotecontrol/Transmitter.hxx | 2 +- 8 files changed, 26 insertions(+), 29 deletions(-)
New commits: commit 3df22ae49a042aff0ad037379697d5ae6b8c3a19 Author: Andrzej J. R. Hunt <andr...@ahunt.org> Date: Wed Jul 18 10:19:35 2012 +0200 Attempted fix for threading & memory bug with Transmitter. Change-Id: I I I6e66d197a18d9707b85804e98a9f690f7dda5087 diff --git a/sd/source/ui/inc/Server.hxx b/sd/source/ui/inc/Server.hxx index 952dcdd..ad17054 100644 --- a/sd/source/ui/inc/Server.hxx +++ b/sd/source/ui/inc/Server.hxx @@ -38,8 +38,8 @@ namespace sd { public: static void setup(); - static void presentationStarted( css::uno::Reference< - css::presentation::XSlideShowController > rController ); + static void presentationStarted( const css::uno::Reference< + css::presentation::XSlideShowController > &rController ); private: Server(); ~Server(); diff --git a/sd/source/ui/remotecontrol/Listener.cxx b/sd/source/ui/remotecontrol/Listener.cxx index a13752f..2ab172c 100644 --- a/sd/source/ui/remotecontrol/Listener.cxx +++ b/sd/source/ui/remotecontrol/Listener.cxx @@ -25,7 +25,6 @@ using rtl::OStringBuffer; Listener::Listener( sd::Transmitter *aTransmitter ) : ::cppu::WeakComponentImplHelper1< XSlideShowListener>( m_aMutex ) { - fprintf( stderr, "Creating Transmitter\n" ); mTransmitter = aTransmitter; } @@ -33,15 +32,13 @@ Listener::~Listener() { } -void Listener::init(css::uno::Reference< css::presentation::XSlideShowController >& aController) +void Listener::init( const css::uno::Reference< css::presentation::XSlideShowController >& aController) { - fprintf( stderr, "Initing Transmitter\n" ); if (aController.is() ) { -// mController = aController; - aController->addSlideShowListener(static_cast<XSlideShowListener*>(this));- + mController = css::uno::Reference< css::presentation::XSlideShowController >( aController ); + aController->addSlideShowListener(static_cast<XSlideShowListener*>(this)); } - fprintf( stderr, "Initiated Transmitter\n" ); } //----- XAnimationListener ---------------------------------------------------- @@ -119,7 +116,10 @@ void SAL_CALL Listener::slideAnimationsEnded (void) void SAL_CALL Listener::disposing (void) { -// FIXME: disconnect as appropriate + if ( mController.is() ) + { + mController->removeSlideShowListener( static_cast<XSlideShowListener*>(this) ); + } } void SAL_CALL Listener::disposing ( @@ -127,6 +127,6 @@ void SAL_CALL Listener::disposing ( throw (::com::sun::star::uno::RuntimeException) { (void) rEvent; -// FIXME: disconnect as appropriate + dispose(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file diff --git a/sd/source/ui/remotecontrol/Listener.hxx b/sd/source/ui/remotecontrol/Listener.hxx index a70ede1..456a4ff 100644 --- a/sd/source/ui/remotecontrol/Listener.hxx +++ b/sd/source/ui/remotecontrol/Listener.hxx @@ -30,7 +30,7 @@ class Listener public: Listener( sd::Transmitter *aTransmitter ); ~Listener(); - void init( css::uno::Reference< css::presentation::XSlideShowController >& aController); + void init( const css::uno::Reference< css::presentation::XSlideShowController >& aController); // XAnimationListener virtual void SAL_CALL beginEvent(const css::uno::Reference< diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx index 153ffc5..8ab8e66 100644 --- a/sd/source/ui/remotecontrol/Receiver.cxx +++ b/sd/source/ui/remotecontrol/Receiver.cxx @@ -143,7 +143,7 @@ void sendPreview(sal_uInt32 aSlideNumber, uno::Sequence<sal_Int8> preparePreview(sal_uInt32 aSlideNumber, - uno::Reference<presentation::XSlideShowController> xSlideShowController, + const uno::Reference<presentation::XSlideShowController> &xSlideShowController, sal_uInt32 aWidth, sal_uInt32 aHeight, sal_uInt64 &rSize ) { (void)aWidth; (void)aHeight; // FIXME: remove me when I'm used diff --git a/sd/source/ui/remotecontrol/Receiver.hxx b/sd/source/ui/remotecontrol/Receiver.hxx index df736ad..688c074 100644 --- a/sd/source/ui/remotecontrol/Receiver.hxx +++ b/sd/source/ui/remotecontrol/Receiver.hxx @@ -39,7 +39,7 @@ private: } -css::uno::Sequence<sal_Int8> preparePreview(sal_uInt32 aSlideNumber, css::uno::Reference<css::presentation::XSlideShowController> xSlideShowController, sal_uInt32 aWidth, sal_uInt32 aHeight, sal_uInt64 &aSize ); +css::uno::Sequence<sal_Int8> preparePreview(sal_uInt32 aSlideNumber, const css::uno::Reference<css::presentation::XSlideShowController>& xSlideShowController, sal_uInt32 aWidth, sal_uInt32 aHeight, sal_uInt64 &aSize ); void sendPreview(sal_uInt32 aSlideNumber, css::uno::Reference<css::presentation::XSlideShowController> xSlideShowController, sd::Transmitter *aTransmitter ); diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx index 748cbf9..c4f252b 100644 --- a/sd/source/ui/remotecontrol/Server.cxx +++ b/sd/source/ui/remotecontrol/Server.cxx @@ -58,7 +58,7 @@ void Server::listenThread() } catch ( com::sun::star::uno::RuntimeException &e ) { - fprintf( stderr, "Exeption on add\n" ); + fprintf( stderr, "Exception on add\n" ); } @@ -127,16 +127,14 @@ void Server::execute() } -void Server::presentationStarted( css::uno::Reference< - css::presentation::XSlideShowController > rController ) +void Server::presentationStarted( const css::uno::Reference< + css::presentation::XSlideShowController > &rController ) { - if ( mTransmitter ) - { - fprintf( stderr, "Adding Listener on start of presentation.\n" ); - Listener* aListener = new Listener( mTransmitter ); - aListener->init( rController ); - fprintf( stderr, "Added the listener as desired.\n" ); - } +// if ( mTransmitter ) +// { +// Listener* aListener = new Listener( mTransmitter ); +// aListener->init( rController ); +// } } diff --git a/sd/source/ui/remotecontrol/Transmitter.cxx b/sd/source/ui/remotecontrol/Transmitter.cxx index 24189a3..dbe902b 100644 --- a/sd/source/ui/remotecontrol/Transmitter.cxx +++ b/sd/source/ui/remotecontrol/Transmitter.cxx @@ -15,12 +15,9 @@ using namespace sd; Transmitter::Transmitter( StreamSocket &aSocket ) : Thread( "TransmitterThread" ), - mStreamSocket( aSocket ), - mQueuesNotEmpty(), - mQueueMutex() + mStreamSocket( aSocket ) { launch(); - // Start a thread } void @@ -29,6 +26,7 @@ Transmitter::execute() fprintf( stderr, "Waiting\n" ); while( mQueuesNotEmpty.wait() ) { + fprintf( stderr, "Continuing after condition\n" ); while ( true ) { osl::MutexGuard aQueueGuard( mQueueMutex ); @@ -64,7 +62,7 @@ Transmitter::~Transmitter() } -void Transmitter::addMessage( OString aMessage, Priority aPriority ) +void Transmitter::addMessage( const OString aMessage, const Priority aPriority ) { osl::MutexGuard aQueueGuard( mQueueMutex ); switch ( aPriority ) @@ -77,6 +75,7 @@ void Transmitter::addMessage( OString aMessage, Priority aPriority ) break; } mQueuesNotEmpty.set(); + fprintf( stderr, "Added\n" ); } diff --git a/sd/source/ui/remotecontrol/Transmitter.hxx b/sd/source/ui/remotecontrol/Transmitter.hxx index 38f0534..7fbfe73 100644 --- a/sd/source/ui/remotecontrol/Transmitter.hxx +++ b/sd/source/ui/remotecontrol/Transmitter.hxx @@ -27,7 +27,7 @@ public: enum Priority { LOW = 1, HIGH }; Transmitter( osl::StreamSocket &aSocket ); ~Transmitter(); - void addMessage( rtl::OString aMessage, Priority aPriority ); + void addMessage( const rtl::OString aMessage, const Priority aPriority ); private: void execute(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits