summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2012-11-22 16:17:58 +0100
committerThorsten Behrens <tbehrens@suse.com>2012-11-22 16:48:58 +0100
commit4ab63a3aacdaa819fa98957fa017978e768931bd (patch)
tree776f720ce5b18938c7636d416d3b0985a761a0fd /sd
parentee81525263b9690a79cd32e7fb769ec0d33117cd (diff)
Fix race & deadlock in sdremote
Neither deleting the thread from the outside, nor keeping a reference inside the thread to an object that might die beforehand is a terribly good idea. Thread now commits suicide when loop finishes. Change-Id: Ia97903765cde1d340d5bcc8161e6fa6b699d0047
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/remotecontrol/ImagePreparer.cxx7
-rw-r--r--sd/source/ui/remotecontrol/ImagePreparer.hxx5
-rw-r--r--sd/source/ui/remotecontrol/Listener.cxx15
-rw-r--r--sd/source/ui/remotecontrol/Listener.hxx2
4 files changed, 8 insertions, 21 deletions
diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx
index e5423d392695..fa642df09a9c 100644
--- a/sd/source/ui/remotecontrol/ImagePreparer.cxx
+++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx
@@ -54,11 +54,10 @@ using namespace ::com::sun::star::uno;
ImagePreparer::ImagePreparer(
const uno::Reference<presentation::XSlideShowController>& rxController,
- Transmitter *aTransmitter, rtl::Reference<ImagePreparer>& rRef )
+ Transmitter *aTransmitter )
: Thread( "ImagePreparer Thread" ),
xController( rxController ),
- pTransmitter( aTransmitter ),
- mRef( rRef )
+ pTransmitter( aTransmitter )
{
}
@@ -85,7 +84,7 @@ void ImagePreparer::execute()
}
sendNotes( i );
}
- mRef.clear();
+ delete this;
}
void ImagePreparer::sendPreview( sal_uInt32 aSlideNumber )
diff --git a/sd/source/ui/remotecontrol/ImagePreparer.hxx b/sd/source/ui/remotecontrol/ImagePreparer.hxx
index 130eeb699041..2743775dac7e 100644
--- a/sd/source/ui/remotecontrol/ImagePreparer.hxx
+++ b/sd/source/ui/remotecontrol/ImagePreparer.hxx
@@ -10,7 +10,6 @@
#define _SD_IMPRESSREMOTE_IMAGEPREPARER_HXX
#include <salhelper/thread.hxx>
-#include <rtl/ref.hxx>
#include <com/sun/star/presentation/XSlideShowController.hpp>
@@ -27,14 +26,12 @@ class ImagePreparer:
public:
ImagePreparer( const
css::uno::Reference<css::presentation::XSlideShowController>&
- rxController, sd::Transmitter *aTransmitter,
- rtl::Reference<ImagePreparer>& rRef );
+ rxController, sd::Transmitter *aTransmitter );
~ImagePreparer();
private:
css::uno::Reference<css::presentation::XSlideShowController> xController;
Transmitter *pTransmitter;
- rtl::Reference<ImagePreparer>& mRef;
// Thread method
void execute();
diff --git a/sd/source/ui/remotecontrol/Listener.cxx b/sd/source/ui/remotecontrol/Listener.cxx
index 5044169606c6..344fc27499a2 100644
--- a/sd/source/ui/remotecontrol/Listener.cxx
+++ b/sd/source/ui/remotecontrol/Listener.cxx
@@ -26,8 +26,7 @@ Listener::Listener( const ::rtl::Reference<Communicator>& rCommunicator,
sd::Transmitter *aTransmitter ):
::cppu::WeakComponentImplHelper1< XSlideShowListener >( m_aMutex ),
mCommunicator( rCommunicator ),
- pTransmitter( NULL ),
- mPreparer()
+ pTransmitter( NULL )
{
pTransmitter = aTransmitter;
}
@@ -53,8 +52,8 @@ void Listener::init( const css::uno::Reference< css::presentation::XSlideShowCon
pTransmitter->addMessage( aBuffer.makeStringAndClear(),
Transmitter::PRIORITY_HIGH );
- mPreparer.set( new ImagePreparer( aController, pTransmitter, mPreparer ) );
- mPreparer->launch();
+ ImagePreparer* pPreparer = new ImagePreparer( aController, pTransmitter );
+ pPreparer->launch();
}
else
{
@@ -135,12 +134,6 @@ void SAL_CALL Listener::slideAnimationsEnded (void)
void SAL_CALL Listener::disposing (void)
{
- if ( mPreparer.is() )
- {
- delete mPreparer.get();
- mPreparer = NULL;
- }
-
pTransmitter = NULL;
if ( mController.is() )
{
@@ -157,4 +150,4 @@ void SAL_CALL Listener::disposing (
(void) rEvent;
dispose();
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/remotecontrol/Listener.hxx b/sd/source/ui/remotecontrol/Listener.hxx
index 3eb7f10ae7d6..49405a60b380 100644
--- a/sd/source/ui/remotecontrol/Listener.hxx
+++ b/sd/source/ui/remotecontrol/Listener.hxx
@@ -17,7 +17,6 @@
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/basemutex.hxx>
#include <osl/socket.hxx>
-#include <rtl/ref.hxx>
#include "Communicator.hxx"
#include "Transmitter.hxx"
@@ -68,7 +67,6 @@ private:
rtl::Reference<Communicator> mCommunicator;
sd::Transmitter *pTransmitter;
css::uno::Reference< css::presentation::XSlideShowController > mController;
- rtl::Reference<sd::ImagePreparer> mPreparer;
};
}
#endif // _SD_IMPRESSREMOTE_LISTENER_HXX