tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

39_change_to_DCHECK_in_CloseHandleWrapper.patch (1431B)


      1 # HG changeset patch
      2 # User Bob Owen <bobowencode@gmail.com>
      3 # Date 1563194469 -3600
      4 #      Mon Jul 15 13:41:09 2019 +0100
      5 # Node ID 6d4e1a08b36e4191bd5ba7a338965f42f09162a6
      6 # Parent  7d9b5d8c9b9b36b135237292785537fc13f40226
      7 Bug 1564899: Make CloseHandleWrapper CHECK a DCHECK on non-Nightly builds. r=handyman!
      8 
      9 This is because we are hitting it frequently during PolicyBase::OnJobEmpty and
     10 currently we can't work out how this can happen.
     11 
     12 diff --git a/base/win/scoped_handle_verifier.cc b/base/win/scoped_handle_verifier.cc
     13 --- a/base/win/scoped_handle_verifier.cc
     14 +++ b/base/win/scoped_handle_verifier.cc
     15 @@ -111,17 +111,23 @@ ScopedHandleVerifier* ScopedHandleVerifi
     16   if (!g_active_verifier)
     17     ScopedHandleVerifier::InstallVerifier();
     18 
     19   return g_active_verifier;
     20 }
     21 
     22 bool CloseHandleWrapper(HANDLE handle) {
     23   if (!::CloseHandle(handle))
     24 +    // Making this DCHECK on non-Nighly as we are hitting this frequently,
     25 +    // looks like we are closing handles twice somehow. See bug 1564899.
     26 +#if defined(NIGHTLY_BUILD)
     27     CHECK(false) << "CloseHandle failed";
     28 +#else
     29 +    DCHECK(false) << "CloseHandle failed";
     30 +#endif
     31   return true;
     32 }
     33 
     34 // Assigns the g_active_verifier global within the ScopedHandleVerifier lock.
     35 // If |existing_verifier| is non-null then |enabled| is ignored.
     36 // static
     37 void ScopedHandleVerifier::ThreadSafeAssignOrCreateScopedHandleVerifier(
     38     ScopedHandleVerifier* existing_verifier,