Bug 1772461 - Crash in [@ nsTreeSelection::TimedSelect]. r=NeilDeakin a=pascalc
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Wed, 08 Jun 2022 20:19:19 +0000
changeset 689931 c497833a75f88328a13566009d4e8aebbc810922
parent 689930 33ec479f3c60cb0349f1bada1cd5d5bedd3d0d9d
child 689932 bd412ea2768e4f47c1c2b08b1ad808478fdd5ced
push id16752
push userpchevrel@mozilla.com
push dateFri, 10 Jun 2022 13:52:18 +0000
treeherdermozilla-beta@ca71db57421e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeilDeakin, pascalc
bugs1772461
milestone102.0
Bug 1772461 - Crash in [@ nsTreeSelection::TimedSelect]. r=NeilDeakin a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D148372
layout/xul/tree/nsTreeSelection.cpp
--- a/layout/xul/tree/nsTreeSelection.cpp
+++ b/layout/xul/tree/nsTreeSelection.cpp
@@ -291,16 +291,19 @@ NS_IMETHODIMP nsTreeSelection::TimedSele
   nsresult rv = Select(aIndex);
   if (NS_FAILED(rv)) return rv;
 
   if (aMsec != -1) {
     mSuppressed = suppressSelect;
     if (!mSuppressed) {
       if (mSelectTimer) mSelectTimer->Cancel();
 
+      if (!mTree) {
+        return NS_ERROR_UNEXPECTED;
+      }
       nsIEventTarget* target =
           mTree->OwnerDoc()->EventTargetFor(TaskCategory::Other);
       NS_NewTimerWithFuncCallback(getter_AddRefs(mSelectTimer), SelectCallback,
                                   this, aMsec, nsITimer::TYPE_ONE_SHOT,
                                   "nsTreeSelection::SelectCallback", target);
     }
   }