diff options
author | Andrzej J. R. Hunt <andrzej@ahunt.org> | 2012-07-18 10:19:35 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-06 10:22:57 +0100 |
commit | 38b4c55546dc91e6f90f24b6e8b30530a3093fcf (patch) | |
tree | 3be7aa09b56437bac01a9c513119e3cb468bd9dd /sd | |
parent | 19559652a866ab052f4cdb06d62d08c1d41aef24 (diff) |
Attempted fix for threading & memory bug with Transmitter.
Change-Id: I I I6e66d197a18d9707b85804e98a9f690f7dda5087
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/inc/Server.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Listener.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Listener.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Receiver.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Receiver.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Server.cxx | 18 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Transmitter.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Transmitter.hxx | 2 |
8 files changed, 26 insertions, 29 deletions
diff --git a/sd/source/ui/inc/Server.hxx b/sd/source/ui/inc/Server.hxx index 952dcdd24747..ad1705447b6d 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 a13752f05fbf..2ab172c62e55 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 a70ede14fa3c..456a4ff55269 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 153ffc51dc92..8ab8e666aef4 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 df736ad7938a..688c0742db83 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 748cbf9a13f0..c4f252b847b4 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 24189a381862..dbe902b8bd98 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 38f05342e6e6..7fbfe736e9a6 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(); |