[Libreoffice-commits] core.git: sd/source

Andrzej Hunt andrzej.hunt at collabora.com
Tue Mar 18 05:21:12 PDT 2014


 sd/source/ui/remotecontrol/DiscoveryService.cxx |   33 ++++++++++++++----------
 sd/source/ui/remotecontrol/DiscoveryService.hxx |    6 ++++
 2 files changed, 26 insertions(+), 13 deletions(-)

New commits:
commit c0fb2640665d552b39deb2192d59fa11ea701d51
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Mar 18 07:34:48 2014 +0000

    fdo#75328 Do DiscoveryService socket setup off the main thread.
    
    Change-Id: I795f365981d8e7983c9f32531c9ec2ae4793c8f4

diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx
index 1919b60..42563ed 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.cxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx
@@ -55,8 +55,24 @@ using namespace rtl;
 using namespace sd;
 
 DiscoveryService::DiscoveryService()
+    : zService( 0 )
+{
+}
+
+DiscoveryService::~DiscoveryService()
+{
+  #ifdef WNT
+    closesocket( mSocket );
+  #else
+    close( mSocket );
+  #endif
+
+     if (zService)
+         zService->clear();
+}
+
+void DiscoveryService::setupSockets()
 {
-    zService = NULL;
 
 #ifdef MACOSX
     // Bonjour for OSX
@@ -119,21 +135,12 @@ DiscoveryService::DiscoveryService()
     }
 }
 
-DiscoveryService::~DiscoveryService()
-{
-  #ifdef WNT
-    closesocket( mSocket );
-  #else
-    close( mSocket );
-  #endif
-
-     if (zService)
-         zService->clear();
-}
-
 void SAL_CALL DiscoveryService::run()
 {
     osl::Thread::setName("DiscoveryService");
+
+    setupSockets();
+
     // Kept for backwrad compatibility
     char aBuffer[BUFFER_SIZE];
     while ( true )
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.hxx b/sd/source/ui/remotecontrol/DiscoveryService.hxx
index 9edfd69..03bbf87 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.hxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.hxx
@@ -30,6 +30,12 @@ namespace sd
             DiscoveryService();
             ~DiscoveryService();
 
+            /**
+             * Networking related setup -- must be run within our own thread
+             * to prevent the application blocking (fdo#75328).
+             */
+            void setupSockets();
+
             static DiscoveryService *spService;
             virtual void SAL_CALL run();
             int mSocket;


More information about the Libreoffice-commits mailing list