diff --git a/dom/events/ContentEventHandler.cpp b/dom/events/ContentEventHandler.cpp index 38c6ad0207..11fb53029b 100644 --- a/dom/events/ContentEventHandler.cpp +++ b/dom/events/ContentEventHandler.cpp @@ -116,10 +116,9 @@ ContentEventHandler::InitBasic() // If text frame which has overflowing selection underline is dirty, // we need to flush the pending reflow here. - mPresShell->FlushPendingNotifications(Flush_Layout); - - // Flushing notifications can cause mPresShell to be destroyed (bug 577963). - NS_ENSURE_TRUE(!mPresShell->IsDestroying(), NS_ERROR_FAILURE); + if (nsIDocument* doc = mPresShell->GetDocument()) { + doc->FlushPendingNotifications(Flush_Layout); + } return NS_OK; }