Selaa lähdekoodia

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.
Andreas Kling 4 vuotta sitten
vanhempi
commit
bf1ed34236
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      Libraries/LibWeb/OutOfProcessWebView.cpp

+ 4 - 0
Libraries/LibWeb/OutOfProcessWebView.cpp

@@ -214,6 +214,10 @@ void OutOfProcessWebView::did_scroll()
 
 
 void OutOfProcessWebView::request_repaint()
 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()));
     client().post_message(Messages::WebContentServer::Paint(m_back_bitmap->rect().translated(horizontal_scrollbar().value(), vertical_scrollbar().value()), m_back_bitmap->shbuf_id()));
 }
 }