Bug 1406229 fix autocomplete crash in panels when window is closed during event, r?mak draft
authorShane Caraveo <scaraveo@mozilla.com>
Fri, 06 Oct 2017 16:58:15 -0700
changeset 676260 6a86ed2d9bdd7f2d7f9cd39f265a37240d56ef73
parent 675689 19b32a138d08f73961df878a29de6f0aad441683
child 734899 0ac598836870dd2da294af7e84d5e30a5f0d32d7
push id83452
push usermixedpuppy@gmail.com
push dateSat, 07 Oct 2017 00:17:34 +0000
reviewersmak
bugs1406229
milestone58.0a1
Bug 1406229 fix autocomplete crash in panels when window is closed during event, r?mak MozReview-Commit-ID: 6TrLuwrk2nD
toolkit/components/autocomplete/nsAutoCompleteController.cpp
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -362,16 +362,23 @@ nsAutoCompleteController::HandleEnter(bo
       int32_t selectedIndex;
       popup->GetSelectedIndex(&selectedIndex);
       *_retval = selectedIndex >= 0;
     }
   }
 
   // Stop the search, and handle the enter.
   StopSearch();
+  // StopSearch() can call PostSearchCleanup() which might result
+  // in a blur event, which could null out mInput, so we need to check it
+  // again.  See bug #408463 for more details
+  if (!mInput) {
+    return NS_OK;
+  }
+
   EnterMatch(aIsPopupSelection, aEvent);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::HandleEscape(bool *_retval)
 {