Hello,
I have a problem related to the use of NetworkServiceDiscovery::AvailableServiceList with Android.
When I create an instance of this class , in the constructor I see that it tries to acquire the MulticastLock.
NetworkServiceDiscovery::AvailableServiceList::AvailableServiceList (const String& serviceType, int broadcastPort)
: Thread ("Discovery_listen"), serviceTypeUID (serviceType)
{
#if JUCE_ANDROID
acquireMulticastLock();
#endif
socket.bindToPort (broadcastPort);
startThread (Priority::background);
}
However, when this instance is destroyed, in the destructor, there is releaseMulticastLock() and this causes continuous crashes in my app.
NetworkServiceDiscovery::AvailableServiceList::~AvailableServiceList()
{
socket.shutdown();
stopThread (2000);
#if JUCE_ANDROID
releaseMulticastLock();
#endif
}
My code is :
MyClass {
public:
MyClass(){
asl.reset(new NetworkServiceDiscovery::AvailableServiceList("X",1667));
//Destruct it after 1 sec
Timer::callAfterDelay(1000,[this](){asl.reset();});
}
private:
std::unique_ptr<NetworkServiceDiscovery::AvailableServiceList> asl;
};
Here is the stack trace :
I’m using Juce 7.0.7