From 62f23fd5aa3f4d11e82e37cdc0e863edff159b68 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 14 Dec 2003 02:17:21 +0000 Subject: [PATCH] Calls to OpenClipboard() must be followed by calls to CloseClipboard(). 2003-12-14 Tor Lillqvist * gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be followed by calls to CloseClipboard(). Add a missing call to CloseClipboard(). Found by Adam Wright, fixes #104944. Use API_CALL macro in more places. --- ChangeLog | 7 +++++ ChangeLog.pre-2-10 | 7 +++++ ChangeLog.pre-2-4 | 7 +++++ ChangeLog.pre-2-6 | 7 +++++ ChangeLog.pre-2-8 | 7 +++++ gdk/win32/gdkselection-win32.c | 48 ++++++++++++++-------------------- 6 files changed, 54 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae5a5f0632..69bdf44ae1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-12-14 Tor Lillqvist + + * gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be + followed by calls to CloseClipboard(). Add a missing call to + CloseClipboard(). Found by Adam Wright, fixes #104944. Use + API_CALL macro in more places. + Fri Dec 12 00:12:01 2003 Matthias Clasen * gtk/gtkrange.c (gtk_range_scroll): Fix direction of diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ae5a5f0632..69bdf44ae1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2003-12-14 Tor Lillqvist + + * gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be + followed by calls to CloseClipboard(). Add a missing call to + CloseClipboard(). Found by Adam Wright, fixes #104944. Use + API_CALL macro in more places. + Fri Dec 12 00:12:01 2003 Matthias Clasen * gtk/gtkrange.c (gtk_range_scroll): Fix direction of diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index ae5a5f0632..69bdf44ae1 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +2003-12-14 Tor Lillqvist + + * gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be + followed by calls to CloseClipboard(). Add a missing call to + CloseClipboard(). Found by Adam Wright, fixes #104944. Use + API_CALL macro in more places. + Fri Dec 12 00:12:01 2003 Matthias Clasen * gtk/gtkrange.c (gtk_range_scroll): Fix direction of diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ae5a5f0632..69bdf44ae1 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +2003-12-14 Tor Lillqvist + + * gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be + followed by calls to CloseClipboard(). Add a missing call to + CloseClipboard(). Found by Adam Wright, fixes #104944. Use + API_CALL macro in more places. + Fri Dec 12 00:12:01 2003 Matthias Clasen * gtk/gtkrange.c (gtk_range_scroll): Fix direction of diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ae5a5f0632..69bdf44ae1 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2003-12-14 Tor Lillqvist + + * gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be + followed by calls to CloseClipboard(). Add a missing call to + CloseClipboard(). Found by Adam Wright, fixes #104944. Use + API_CALL macro in more places. + Fri Dec 12 00:12:01 2003 Matthias Clasen * gtk/gtkrange.c (gtk_range_scroll): Fix direction of diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c index 4d55eb7a33..aa1285517f 100644 --- a/gdk/win32/gdkselection-win32.c +++ b/gdk/win32/gdkselection-win32.c @@ -115,7 +115,7 @@ gdk_selection_owner_set_for_display (GdkDisplay *display, guint32 time, gboolean send_event) { - HWND xwindow; + HWND hwnd; GdkEvent tmp_event; gchar *sel_name; @@ -143,32 +143,26 @@ gdk_selection_owner_set_for_display (GdkDisplay *display, if (GDK_WINDOW_DESTROYED (owner)) return FALSE; - xwindow = GDK_WINDOW_HWND (owner); + hwnd = GDK_WINDOW_HWND (owner); } else - xwindow = NULL; + hwnd = NULL; - if (!OpenClipboard (xwindow)) + if (!API_CALL (OpenClipboard, (hwnd))) + return FALSE; + + if (!API_CALL (EmptyClipboard, ())) { - WIN32_API_FAILED ("OpenClipboard"); - return FALSE; - } - if (!EmptyClipboard ()) - { - WIN32_API_FAILED ("EmptyClipboard"); - CloseClipboard (); + API_CALL (CloseClipboard, ()); return FALSE; } #if 0 /* No delayed rendering */ - if (xwindow != NULL) + if (hwnd != NULL) SetClipboardData (CF_TEXT, NULL); #endif - if (!CloseClipboard ()) - { - WIN32_API_FAILED ("CloseClipboard"); - return FALSE; - } + if (!API_CALL (CloseClipboard, ())) + return FALSE; if (owner != NULL) { @@ -183,7 +177,7 @@ gdk_selection_owner_set_for_display (GdkDisplay *display, tmp_event.selection.selection = selection; tmp_event.selection.target = GDK_TARGET_STRING; tmp_event.selection.property = _gdk_selection_property; - tmp_event.selection.requestor = (guint32) xwindow; + tmp_event.selection.requestor = (guint32) hwnd; tmp_event.selection.time = time; gdk_event_put (&tmp_event); @@ -273,11 +267,8 @@ gdk_selection_convert (GdkWindow *requestor, /* He wants to know what formats are on the clipboard. If there * is some kind of text, tell him so. */ - if (!OpenClipboard (GDK_WINDOW_HWND (requestor))) - { - WIN32_API_FAILED ("OpenClipboard"); - return; - } + if (!API_CALL (OpenClipboard, (GDK_WINDOW_HWND (requestor)))) + return; if (IsClipboardFormatAvailable (CF_UNICODETEXT) || IsClipboardFormatAvailable (_cf_utf8_string) || @@ -290,6 +281,8 @@ gdk_selection_convert (GdkWindow *requestor, } else property = GDK_NONE; + + API_CALL (CloseClipboard, ()); } else if (selection == GDK_SELECTION_CLIPBOARD && (target == _compound_text || @@ -299,11 +292,8 @@ gdk_selection_convert (GdkWindow *requestor, * contents of the clipboard. Get the clipboard data, * and store it for later. */ - if (!OpenClipboard (GDK_WINDOW_HWND (requestor))) - { - WIN32_API_FAILED ("OpenClipboard"); - return; - } + if (!API_CALL (OpenClipboard, (GDK_WINDOW_HWND (requestor)))) + return; /* Try various formats. First the simplest, CF_UNICODETEXT. */ if ((hdata = GetClipboardData (CF_UNICODETEXT)) != NULL) @@ -424,7 +414,7 @@ gdk_selection_convert (GdkWindow *requestor, else property = GDK_NONE; - CloseClipboard (); + API_CALL (CloseClipboard, ()); } else if (selection == _gdk_win32_dropfiles) {