diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx index 1919b60cd796..42563ed1fd2e 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 9edfd69a02fc..03bbf87e4e96 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;