Fix a bunch of cases where XGetWindowProperty() is called without trapping

Mon Mar 13 18:37:55 2000  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdkdnd.c: Fix a bunch of cases where XGetWindowProperty()
	is called without trapping X errors.
This commit is contained in:
Owen Taylor
2000-03-13 23:41:53 +00:00
committed by Owen Taylor
parent 4078590376
commit 74bd7ec0a1
8 changed files with 67 additions and 22 deletions

View File

@@ -1,3 +1,8 @@
Mon Mar 13 18:37:55 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c: Fix a bunch of cases where XGetWindowProperty()
is called without trapping X errors.
Thu Mar 9 22:10:56 GMT 2000 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update:

View File

@@ -1,3 +1,8 @@
Mon Mar 13 18:37:55 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c: Fix a bunch of cases where XGetWindowProperty()
is called without trapping X errors.
Thu Mar 9 22:10:56 GMT 2000 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update:

View File

@@ -1,3 +1,8 @@
Mon Mar 13 18:37:55 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c: Fix a bunch of cases where XGetWindowProperty()
is called without trapping X errors.
Thu Mar 9 22:10:56 GMT 2000 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update:

View File

@@ -1,3 +1,8 @@
Mon Mar 13 18:37:55 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c: Fix a bunch of cases where XGetWindowProperty()
is called without trapping X errors.
Thu Mar 9 22:10:56 GMT 2000 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update:

View File

@@ -1,3 +1,8 @@
Mon Mar 13 18:37:55 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c: Fix a bunch of cases where XGetWindowProperty()
is called without trapping X errors.
Thu Mar 9 22:10:56 GMT 2000 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update:

View File

@@ -1,3 +1,8 @@
Mon Mar 13 18:37:55 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c: Fix a bunch of cases where XGetWindowProperty()
is called without trapping X errors.
Thu Mar 9 22:10:56 GMT 2000 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update:

View File

@@ -1,3 +1,8 @@
Mon Mar 13 18:37:55 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c: Fix a bunch of cases where XGetWindowProperty()
is called without trapping X errors.
Thu Mar 9 22:10:56 GMT 2000 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update:

View File

@@ -947,6 +947,7 @@ motif_read_target_table (void)
guchar *p;
gboolean success = FALSE;
gdk_error_trap_push ();
XGetWindowProperty (gdk_display, motif_drag_window,
motif_drag_targets_atom,
0, (sizeof(MotifTargetTableHeader)+3)/4, FALSE,
@@ -954,12 +955,13 @@ motif_read_target_table (void)
&type, &format, &nitems, &bytes_after,
(guchar **)&header);
if ((format != 8) || (nitems < sizeof (MotifTargetTableHeader)))
if (gdk_error_trap_pop () || (format != 8) || (nitems < sizeof (MotifTargetTableHeader)))
goto error;
header->n_lists = card16_to_host (header->n_lists, header->byte_order);
header->total_size = card32_to_host (header->total_size, header->byte_order);
gdk_error_trap_push ();
XGetWindowProperty (gdk_display, motif_drag_window, motif_drag_targets_atom,
(sizeof(MotifTargetTableHeader)+3)/4,
(header->total_size + 3)/4 - (sizeof(MotifTargetTableHeader) + 3)/4,
@@ -967,7 +969,7 @@ motif_read_target_table (void)
motif_drag_targets_atom, &type, &format, &nitems,
&bytes_after, &target_bytes);
if ((format != 8) || (bytes_after != 0) ||
if (gdk_error_trap_pop () || (format != 8) || (bytes_after != 0) ||
(nitems != header->total_size - sizeof(MotifTargetTableHeader)))
goto error;
@@ -1291,29 +1293,33 @@ motif_check_dest (Window win)
if (!motif_drag_receiver_info_atom)
motif_drag_receiver_info_atom = gdk_atom_intern ("_MOTIF_DRAG_RECEIVER_INFO", FALSE);
gdk_error_trap_push ();
XGetWindowProperty (gdk_display, win,
motif_drag_receiver_info_atom,
0, (sizeof(*info)+3)/4, False, AnyPropertyType,
&type, &format, &nitems, &after,
(guchar **)&info);
if (type != None)
{
if ((format == 8) && (nitems == sizeof(*info)))
{
if ((info->protocol_version == 0) &&
((info->protocol_style == XmDRAG_PREFER_PREREGISTER) ||
(info->protocol_style == XmDRAG_PREFER_DYNAMIC) ||
(info->protocol_style == XmDRAG_DYNAMIC)))
retval = TRUE;
}
else
{
GDK_NOTE (DND,
g_warning ("Invalid Motif drag receiver property on window %ld\n", win));
}
XFree (info);
if (gdk_error_trap_pop() == 0)
{
if (type != None)
{
if ((format == 8) && (nitems == sizeof(*info)))
{
if ((info->protocol_version == 0) &&
((info->protocol_style == XmDRAG_PREFER_PREREGISTER) ||
(info->protocol_style == XmDRAG_PREFER_DYNAMIC) ||
(info->protocol_style == XmDRAG_DYNAMIC)))
retval = TRUE;
}
else
{
GDK_NOTE (DND,
g_warning ("Invalid Motif drag receiver property on window %ld\n", win));
}
XFree (info);
}
}
return retval ? win : GDK_NONE;
@@ -1472,13 +1478,14 @@ motif_read_initiator_info (Window source_window,
if (!motif_drag_initiator_info)
motif_drag_initiator_info = gdk_atom_intern ("_MOTIF_DRAG_INITIATOR_INFO", FALSE);
gdk_error_trap_push ();
XGetWindowProperty (gdk_display, source_window, atom,
0, sizeof(*initiator_info), FALSE,
motif_drag_initiator_info,
&type, &format, &nitems, &bytes_after,
(guchar **)&initiator_info);
if ((format != 8) || (nitems != sizeof (MotifDragInitiatorInfo)) || (bytes_after != 0))
if (gdk_error_trap_pop () || (format != 8) || (nitems != sizeof (MotifDragInitiatorInfo)) || (bytes_after != 0))
{
g_warning ("Error reading initiator info\n");
return FALSE;
@@ -2509,13 +2516,14 @@ xdnd_enter_filter (GdkXEvent *xev,
new_context->targets = NULL;
if (get_types)
{
gdk_error_trap_push ();
XGetWindowProperty (GDK_WINDOW_XDISPLAY (event->any.window),
source_window,
gdk_atom_intern ("XdndTypeList", FALSE), 0, 65536,
False, XA_ATOM, &type, &format, &nitems,
&after, (guchar **)&data);
if ((format != 32) || (type != XA_ATOM))
if (gdk_error_trap_pop () || (format != 32) || (type != XA_ATOM))
{
gdk_drag_context_unref (new_context);
return GDK_FILTER_REMOVE;
@@ -2777,10 +2785,12 @@ gdk_drag_get_protocol (guint32 xid,
if (xid == gdk_root_window)
rootwin = TRUE;
gdk_error_warnings = 0;
if (!rootwin)
{
gdk_error_code = 0;
XGetWindowProperty (gdk_display, xid,
gdk_atom_intern ("ENLIGHTENMENT_DESKTOP", FALSE),
0, 0, False, AnyPropertyType,