[Libreoffice-commits] .: 3 commits - android/sdremote sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 22 07:49:32 PST 2012


 android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java   |    3 --
 android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java |    4 ++
 sd/source/ui/remotecontrol/ImagePreparer.cxx                                   |    7 ++---
 sd/source/ui/remotecontrol/ImagePreparer.hxx                                   |    5 ---
 sd/source/ui/remotecontrol/Listener.cxx                                        |   14 ++--------
 sd/source/ui/remotecontrol/Listener.hxx                                        |    2 -
 6 files changed, 12 insertions(+), 23 deletions(-)

New commits:
commit 4ab63a3aacdaa819fa98957fa017978e768931bd
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Thu Nov 22 16:17:58 2012 +0100

    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

diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx
index e5423d3..fa642df 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 130eeb6..2743775 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 5044169..344fc27 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 3eb7f10..49405a6 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
commit ee81525263b9690a79cd32e7fb769ec0d33117cd
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Thu Nov 22 16:38:14 2012 +0100

    Fix seemingly hanging thumbnail preview.
    
    5 secs timeout between slide changes is probably a bit much,
    reducing to half a second now. Had the coverflow frequently stuck
    at earlier slides otherwise.
    
    Change-Id: Idabe17e1fc8fe2050990a68c357a00dd2d20c08b

diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 779e395..029f1d3 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -263,7 +263,7 @@ public class PresentationFragment extends SherlockFragment {
 
                 if (aSlide == mTopView.getSelectedItemPosition())
                     return;
-                if ((System.currentTimeMillis() - lastUpdateTime) < 5000) {
+                if ((System.currentTimeMillis() - lastUpdateTime) < 500) {
                     return;
                 }
                 mTopView.setSelection(aSlide, true);
@@ -319,4 +319,4 @@ public class PresentationFragment extends SherlockFragment {
         }
     }
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 07af8451feabd828d09c0f444368fa50c5651527
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Thu Nov 22 16:40:01 2012 +0100

    Broadcast even initial slidenumber to coverflow.
    
    A new slideshow should start at the correct slide, thus it needs
    to be communicated to the thumbnail fragments.
    
    Change-Id: Ib8107b4391f0df9a8d7b23f03d4da36ab42fddcc

diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
index c4a097e..df6aded 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
@@ -51,6 +51,10 @@ public class Receiver {
             Intent aIntent = new Intent(
                             CommunicationService.STATUS_CONNECTED_SLIDESHOW_RUNNING);
             LocalBroadcastManager.getInstance(mContext).sendBroadcast(aIntent);
+            aIntent = new Intent(
+                     CommunicationService.MSG_SLIDE_CHANGED);
+            aIntent.putExtra("slide_number", aCurrentSlide);
+            LocalBroadcastManager.getInstance(mContext).sendBroadcast(aIntent);
         } else if (aInstruction.equals("slideshow_finished")) {
             mSlideShow = new SlideShow(mContext);
             //            Intent aIntent = new Intent(mContext.getApplicationContext(),


More information about the Libreoffice-commits mailing list