From bf1ed342365e6cf4a7a7dd04e640592a63c17f7b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 24 Oct 2020 12:28:38 +0200 Subject: [PATCH] LibWeb: Don't send OOPWV repaint requests for views without backing This fixes an assertion in TextEditor when changing the system theme, since that would trigger a repaint request for the HTML preview widget which may not have backing unless it's actually been used to perform HTML (or Markdown) preview yet. --- Libraries/LibWeb/OutOfProcessWebView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/LibWeb/OutOfProcessWebView.cpp b/Libraries/LibWeb/OutOfProcessWebView.cpp index 22c62fe9dd..ec62289ece 100644 --- a/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -214,6 +214,10 @@ void OutOfProcessWebView::did_scroll() void OutOfProcessWebView::request_repaint() { + // If this widget was instantiated but not yet added to a window, + // it won't have a back bitmap yet, so we can just skip repaint requests. + if (!m_back_bitmap) + return; client().post_message(Messages::WebContentServer::Paint(m_back_bitmap->rect().translated(horizontal_scrollbar().value(), vertical_scrollbar().value()), m_back_bitmap->shbuf_id())); }