[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sd/source
Andrzej Hunt
andrzej.hunt at collabora.com
Mon Mar 24 04:04:47 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 295c0c40682581215756e8bd744c8f2b04bd1acf
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
(cherry picked from commit c0fb2640665d552b39deb2192d59fa11ea701d51)
Reviewed-on: https://gerrit.libreoffice.org/8643
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx
index 26da311..d8ae313 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
@@ -114,21 +130,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