Bonjour - Fix memory leak and service rediscovery

The QSocketNotifiers for the resolver and address were not being deleted in
cleanUp().  This would cause a memory leak and also prevent a service from
being rediscovered after removed and added back on another device.  I
suspect the undeleted QSocketNotifier was holding a file descriptor open
which would break things.  Should fix

issue #27
Power-Cycling Bonjour Devices Can Cause Permanent Loss
https://github.com/jbagg/QtZeroConf/issues/27

and pull request #34
macOS: Fixed undetected service stop/start while the application is running
https://github.com/jbagg/QtZeroConf/pull/34
This commit is contained in:
Jonathan Bagg
2020-07-06 22:05:29 -04:00
parent 5c4bdf1a56
commit d346cd78a7

View File

@ -47,6 +47,8 @@ void Resolver::cleanUp()
{
DNSServiceRefDeallocate(DNSresolverRef);
DNSServiceRefDeallocate(DNSaddressRef);
delete resolverNotifier;
delete addressNotifier;
QString key = zcs->name() + QString::number(zcs->interfaceIndex());
ref->resolvers.remove(key);
delete this;