From bb366a77262db2f14159a25c624183bffcf2efb8 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Mon, 11 Apr 2011 14:56:25 +0200 Subject: [PATCH mumble] fix bonjour support using avahi compat lib several reads may be required until the resolved callback fires so don't delete record in the read callback. --- src/bonjour/bonjourserviceresolver.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bonjour/bonjourserviceresolver.cpp b/src/bonjour/bonjourserviceresolver.cpp index 534095c..3bbdc66 100644 --- a/src/bonjour/bonjourserviceresolver.cpp +++ b/src/bonjour/bonjourserviceresolver.cpp @@ -77,7 +77,6 @@ void BonjourServiceResolver::resolveBonjourRecord(const BonjourRecord &record) { void BonjourServiceResolver::bonjourSocketReadyRead(int sockfd) { ResolveRecord *rr = qmResolvers.value(sockfd); - qmResolvers.remove(sockfd); if (! rr) return; @@ -86,7 +85,6 @@ void BonjourServiceResolver::bonjourSocketReadyRead(int sockfd) { if (err != kDNSServiceErr_NoError) emit error(rr->record, err); - delete rr; } @@ -95,6 +93,7 @@ void BonjourServiceResolver::bonjourResolveReply(DNSServiceRef, DNSServiceFlags const char *, const char *hosttarget, quint16 port, quint16 , const char *, void *context) { ResolveRecord *rr = static_cast(context); + rr->bsr->qmResolvers.remove(DNSServiceRefSockFD(rr->dnssref)); if (errorCode != kDNSServiceErr_NoError) { emit rr->bsr->error(rr->record, errorCode); @@ -102,4 +101,5 @@ void BonjourServiceResolver::bonjourResolveReply(DNSServiceRef, DNSServiceFlags } rr->bonjourPort = qFromBigEndian(port); emit rr->bsr->bonjourRecordResolved(rr->record, QString::fromUtf8(hosttarget), rr->bonjourPort); + delete rr; } -- 1.7.3.4