From 4d778226ed95fadb5a1ac4869ae2c830d388890c Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sat, 4 Mar 2023 21:03:25 +0800 Subject: [PATCH] Issue #2135 - Bug 1433669/Part 2: Flush the document instead of the shell in ContentEventHandler * Unlike the original patch, I went with just getting a reference to the document rather than replacing mPresShell with mDocument. --- dom/events/ContentEventHandler.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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; }