Attachment #8865332: (v4) Do not run ScriptRunner in the intermediate state before destroying PreShell, PresContext, etc at nsDocumentViewer::Hide() is done. r=bz for bug #1356558

View | Details | Raw Unified | Return to bug 1356558
Collapse All | Expand All

(-)a/layout/base/nsDocumentViewer.cpp (-13 / +18 lines)
Line     Link Here 
 Lines 2210-2228   nsDocumentViewer::Hide(void) Link Here 
2210
    mPresShell->CaptureHistoryState(getter_AddRefs(layoutState));
2210
    mPresShell->CaptureHistoryState(getter_AddRefs(layoutState));
2211
  }
2211
  }
2212
2212
2213
  DestroyPresShell();
2213
  {
2214
2214
    // Do not run ScriptRunners queued by DestroyPresShell() in the intermediate
2215
  DestroyPresContext();
2215
    // state before we're done destroying PresShell, PresContext, ViewManager, etc.
2216
2216
    nsAutoScriptBlocker scriptBlocker;
2217
  mViewManager   = nullptr;
2217
    DestroyPresShell();
2218
  mWindow        = nullptr;
2218
2219
  mDeviceContext = nullptr;
2219
    DestroyPresContext();
2220
  mParentWidget  = nullptr;
2220
2221
2221
    mViewManager   = nullptr;
2222
  nsCOMPtr<nsIBaseWindow> base_win(mContainer);
2222
    mWindow        = nullptr;
2223
2223
    mDeviceContext = nullptr;
2224
  if (base_win && !mAttachedToParent) {
2224
    mParentWidget  = nullptr;
2225
    base_win->SetParentWidget(nullptr);
2225
2226
    nsCOMPtr<nsIBaseWindow> base_win(mContainer);
2227
2228
    if (base_win && !mAttachedToParent) {
2229
      base_win->SetParentWidget(nullptr);
2230
    }
2226
  }
2231
  }
2227
2232
2228
  return NS_OK;
2233
  return NS_OK;

Return to bug 1356558