From 3bc9316f0dc7b5abf963f903c68b5d9f01738890 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 23 Dec 2022 19:51:45 +0100 Subject: [PATCH] Revert static initialization change from fea6eded4 --- src/wine-host/editor.cpp | 19 +++---------------- src/wine-host/xdnd-proxy.cpp | 28 ++++------------------------ 2 files changed, 7 insertions(+), 40 deletions(-) diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index a800efb8..b57e3909 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -113,21 +113,8 @@ constexpr uint32_t xembed_focus_first = 1; /** * The default arrow cursor used in Windows. - * - * FIXME: This used to be loaded as a constant, but Wine 7.21 caused this static - * initialization to hang indefinitely: - * https://bugs.winehq.org/show_bug.cgi?id=53912 - * Revert this once Wine 7.21 is old enough that noone uses it anymore. */ -// static const HCURSOR arrow_cursor = LoadCursor(nullptr, IDC_ARROW); -inline HCURSOR arrow_cursor() { - static HCURSOR cursor = nullptr; - if (!cursor) { - cursor = LoadCursor(nullptr, IDC_ARROW); - } - - return cursor; -} +static const HCURSOR arrow_cursor = LoadCursor(nullptr, IDC_ARROW); /** * Find the the ancestors for the given window. This returns a list of window @@ -1235,7 +1222,7 @@ LRESULT CALLBACK window_proc(HWND handle, // plugin and keep this as a default. case WM_SETCURSOR: { if (GetCursor() == nullptr) { - SetCursor(arrow_cursor()); + SetCursor(arrow_cursor); } } break; // NOTE: Needed for our `is_cursor_in_wine_window()` implementation. Our @@ -1405,7 +1392,7 @@ ATOM get_window_class() noexcept { window_class.style = CS_DBLCLKS; window_class.lpfnWndProc = window_proc; window_class.hInstance = GetModuleHandle(nullptr); - window_class.hCursor = arrow_cursor(); + window_class.hCursor = arrow_cursor; window_class.lpszClassName = yabridge_window_class_name; window_class_handle = RegisterClassEx(&window_class); diff --git a/src/wine-host/xdnd-proxy.cpp b/src/wine-host/xdnd-proxy.cpp index c66fc6ec..2d404aa2 100644 --- a/src/wine-host/xdnd-proxy.cpp +++ b/src/wine-host/xdnd-proxy.cpp @@ -53,28 +53,8 @@ constexpr char mime_text_uri_list_name[] = "text/uri-list"; constexpr char mime_text_plain_name[] = "text/plain"; // We can cheat by just using the Win32 cursors instead of providing our own -// FIXME: these used to be loaded as a constant, but Wine 7.21 caused this -// static initialization to hang indefinitely: -// https://bugs.winehq.org/show_bug.cgi?id=53912 -// Revert this once Wine 7.21 is old enough that noone uses it anymore. -// static const HCURSOR dnd_accepted_cursor = LoadCursor(nullptr, IDC_HAND); -inline HCURSOR dnd_accepted_cursor() { - static HCURSOR cursor = nullptr; - if (!cursor) { - cursor = LoadCursor(nullptr, IDC_HAND); - } - - return cursor; -} -// static const HCURSOR dnd_denied_cursor = LoadCursor(nullptr, IDC_NO); -inline HCURSOR dnd_denied_cursor() { - static HCURSOR cursor = nullptr; - if (!cursor) { - cursor = LoadCursor(nullptr, IDC_NO); - } - - return cursor; -} +static const HCURSOR dnd_accepted_cursor = LoadCursor(nullptr, IDC_HAND); +static const HCURSOR dnd_denied_cursor = LoadCursor(nullptr, IDC_NO); /** * We're doing a bit of a hybrid between a COM-style reference counted smart @@ -357,9 +337,9 @@ void WineXdndProxy::run_xdnd_loop() { // off. Would it be better to just not do anything // at all here? if (accepts_drop) { - SetCursor(dnd_accepted_cursor()); + SetCursor(dnd_accepted_cursor); } else { - SetCursor(dnd_denied_cursor()); + SetCursor(dnd_denied_cursor); } last_window_accepted_status = accepts_drop;