Fix last error reporting when calling GetClipboardOwner
authorLuca Bacci <luca.bacci982@gmail.com>
Fri, 25 Feb 2022 15:53:12 +0000 (16:53 +0100)
committerLuca Bacci <luca.bacci982@gmail.com>
Fri, 25 Feb 2022 16:14:39 +0000 (17:14 +0100)
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1402

gdk/win32/gdkclipdrop-win32.c

index 5fa826c2610b9f6b8359005829266fb805f9096e..ec15f0fabdfac02815e36a1daad986237f848b63 100644 (file)
@@ -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 ();