[gtk/gtk-3-24: 1/2] Fix last error reporting when calling GetClipboardOwner




commit f19897e71fd7dedbb6a7d97dc1e2e830cf9f93ca
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Fri Feb 25 16:47:43 2022 +0100

    Fix last error reporting when calling GetClipboardOwner
    
    Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1402

 gdk/win32/gdkdisplay-win32.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index 5671e2c254..3afc34ce20 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -550,11 +550,11 @@ inner_clipboard_window_procedure (HWND   hwnd,
         GdkWindow *stored_owner;
         GdkWin32Selection *win32_sel = _gdk_win32_selection_get ();
 
+        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 ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]