diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 0154e2ad7175..b1ec2b740bd8 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -163,10 +163,11 @@ gfx::Size WindowSizeToContentSizeBuggy(HWND hwnd, const gfx::Size& size) { #endif -[[maybe_unused]] bool IsX11() { - return ui::OzonePlatform::GetInstance() - ->GetPlatformProperties() - .electron_can_call_x11; +[[maybe_unused, nodiscard]] bool IsX11() { + static const bool is_x11 = ui::OzonePlatform::GetInstance() + ->GetPlatformProperties() + .electron_can_call_x11; + return is_x11; } class NativeWindowClientView : public views::ClientView {