Bug 1630485 - Stop trying to refresh a task tree that no longer exists. r=pmorris
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 16 Apr 2020 12:37:33 +1200
changeset 38871 01f1041e43c58555469932a4c2d2461e1504b10c
parent 38870 9b6973ce47f508484a09c6a971ec947395bd5431
child 38872 756d8f7c911959eedf4ecbee51b7e3b3c31f0f99
push id401
push userclokep@gmail.com
push dateMon, 01 Jun 2020 20:41:59 +0000
reviewerspmorris
bugs1630485
Bug 1630485 - Stop trying to refresh a task tree that no longer exists. r=pmorris
calendar/base/content/calendar-task-tree.js
--- a/calendar/base/content/calendar-task-tree.js
+++ b/calendar/base/content/calendar-task-tree.js
@@ -453,16 +453,21 @@
       let refreshJob = {
         QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
         tree: this,
         calendar: null,
         items: null,
         operation: null,
 
         onOperationComplete(opCalendar, status, operationType, id, dateTime) {
+          if (!this.tree.mTreeView.tree) {
+            // Looks like we've been disconnected from the DOM, there's no point in continuing.
+            return;
+          }
+
           if (opCalendar.id in this.tree.mPendingRefreshJobs) {
             delete this.tree.mPendingRefreshJobs[opCalendar.id];
           }
 
           let oldItems = this.tree.mTaskArray.filter(item => item.calendar.id == opCalendar.id);
           this.tree.mTreeView.modifyItems(this.items, oldItems);
           this.tree.dispatchEvent(new CustomEvent("refresh", { bubbles: false }));
         },