From 828688d5cd736898d2d5692f08c24351b18b0358 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Fri, 25 Feb 2022 16:53:12 +0100 Subject: [PATCH] Fix last error reporting when calling GetClipboardOwner Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1402 --- gdk/win32/gdkclipdrop-win32.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gdk/win32/gdkclipdrop-win32.c b/gdk/win32/gdkclipdrop-win32.c index 5fa826c261..ec15f0fabd 100644 --- a/gdk/win32/gdkclipdrop-win32.c +++ b/gdk/win32/gdkclipdrop-win32.c @@ -1219,11 +1219,10 @@ inner_clipboard_window_procedure (HWND hwnd, return DefWindowProcW (hwnd, message, wparam, lparam); } + SetLastError (0); hwnd_owner = GetClipboardOwner (); - - if ((hwnd_owner == NULL) && - (GetLastError () != ERROR_SUCCESS)) - WIN32_API_FAILED ("GetClipboardOwner"); + if (hwnd_owner == NULL && GetLastError () != 0) + WIN32_API_FAILED ("GetClipboardOwner"); hwnd_opener = GetOpenClipboardWindow ();