From b0d53f9f525aa54df09550d680d799afa59aea18 Mon Sep 17 00:00:00 2001 From: Alexis Beingessner Date: Thu, 17 Sep 2020 19:30:53 +0000 Subject: [PATCH] Bug 1656266 - Make the window client size atomic to avoid a read/write race. r=mstange Differential Revision: https://phabricator.services.mozilla.com/D90582 --- widget/gtk/GtkCompositorWidget.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/widget/gtk/GtkCompositorWidget.h b/widget/gtk/GtkCompositorWidget.h index ef7a1bc21ad2..7fb94acbc9c5 100644 --- a/widget/gtk/GtkCompositorWidget.h +++ b/widget/gtk/GtkCompositorWidget.h @@ -76,7 +76,15 @@ class GtkCompositorWidget : public CompositorWidget, nsWindow* mWidget; private: - LayoutDeviceIntSize mClientSize; + // Webrender can try to poll this while we're handling a window resize event. + // This read/write race is largely benign because it's fine if webrender and + // the window desync for a frame (leading to the page displaying + // larger/smaller than the window for a split second) -- nobody expects + // perfect rendering while resizing a window. This atomic doesn't change the + // fact that the window and content can display at different sizes, but it + // does make it Not Undefined Behaviour, and also ensures webrender only + // ever uses the old or new size, and not some weird synthesis of the two. + Atomic mClientSize; WindowSurfaceProvider mProvider;