Bug 805425: Fix shutdown crash that can happen when doing DNS logging. r=sworkman
authorJosh Aas <joshmoz@gmail.com>
Fri, 26 Oct 2012 08:12:53 -0400
changeset 111527 1c48b82bce7f99ef8593ae59c8ddae2f61001423
parent 111526 14cf08f2845d0176a9e68b722d9becf5f054dc92
child 111528 e8ed2b39b88c2adaa377572221ff46ea897a33fd
push id23752
push userryanvm@gmail.com
push dateSat, 27 Oct 2012 01:22:44 +0000
treeherdermozilla-central@f9acc2e4d4e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssworkman
bugs805425
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 805425: Fix shutdown crash that can happen when doing DNS logging. r=sworkman
netwerk/dns/nsHostResolver.cpp
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -985,19 +985,20 @@ nsHostResolver::ThreadFunc(void *arg)
                                     Telemetry::DNS_LOOKUP_TIME :
                                     Telemetry::DNS_RENEWAL_TIME,
                                   millis);
         }
         else {
             status = NS_ERROR_UNKNOWN_HOST;
             Telemetry::Accumulate(Telemetry::DNS_FAILED_LOOKUP_TIME, millis);
         }
-        
+
+        // OnLookupComplete may release "rec", log before we lose it.
+        LOG(("Lookup completed for host [%s].\n", rec->host));
         resolver->OnLookupComplete(rec, status, ai);
-        LOG(("Lookup completed for host [%s].\n", rec->host));
     }
     NS_RELEASE(resolver);
     LOG(("DNS lookup thread ending execution.\n"));
 }
 
 //----------------------------------------------------------------------------
 
 nsresult