forked from AuroraMiddleware/gtk
Ignore icons if they would make the request large enough to cause Xlib to
2005-11-08 Matthias Clasen <mclasen@redhat.com> * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Ignore icons if they would make the request large enough to cause Xlib to loose the connection. (#320909, Claudio Saavedra)
This commit is contained in:
parent
8cec420a71
commit
3514077069
@ -1,3 +1,9 @@
|
||||
2005-11-08 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Ignore
|
||||
icons if they would make the request large enough to cause
|
||||
Xlib to loose the connection. (#320909, Claudio Saavedra)
|
||||
|
||||
2005-11-08 Michael Natterer <mitch@imendio.com>
|
||||
|
||||
* gdk/gdk.symbols
|
||||
|
@ -1,3 +1,9 @@
|
||||
2005-11-08 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Ignore
|
||||
icons if they would make the request large enough to cause
|
||||
Xlib to loose the connection. (#320909, Claudio Saavedra)
|
||||
|
||||
2005-11-08 Michael Natterer <mitch@imendio.com>
|
||||
|
||||
* gdk/gdk.symbols
|
||||
|
@ -4017,6 +4017,12 @@ gdk_x11_window_set_user_time (GdkWindow *window,
|
||||
toplevel->user_time = timestamp_long;
|
||||
}
|
||||
|
||||
#define GDK_SELECTION_MAX_SIZE(display) \
|
||||
MIN(262144, \
|
||||
XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) == 0 \
|
||||
? XMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) - 100 \
|
||||
: XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) - 100)
|
||||
|
||||
/**
|
||||
* gdk_window_set_icon_list:
|
||||
* @window: The #GdkWindow toplevel window to set the icon of.
|
||||
@ -4045,6 +4051,7 @@ gdk_window_set_icon_list (GdkWindow *window,
|
||||
gint x, y;
|
||||
gint n_channels;
|
||||
GdkDisplay *display;
|
||||
gint n;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
@ -4055,7 +4062,7 @@ gdk_window_set_icon_list (GdkWindow *window,
|
||||
|
||||
l = pixbufs;
|
||||
size = 0;
|
||||
|
||||
n = 0;
|
||||
while (l)
|
||||
{
|
||||
pixbuf = l->data;
|
||||
@ -4064,8 +4071,16 @@ gdk_window_set_icon_list (GdkWindow *window,
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
/* silently ignore overlarge icons */
|
||||
if (size + 2 + width * height > GDK_SELECTION_MAX_SIZE(display))
|
||||
{
|
||||
g_warning ("gdk_window_set_icon_list: icons too large");
|
||||
break;
|
||||
}
|
||||
|
||||
n++;
|
||||
size += 2 + width * height;
|
||||
|
||||
|
||||
l = g_list_next (l);
|
||||
}
|
||||
|
||||
@ -4073,7 +4088,7 @@ gdk_window_set_icon_list (GdkWindow *window,
|
||||
|
||||
l = pixbufs;
|
||||
p = data;
|
||||
while (l)
|
||||
while (l && n > 0)
|
||||
{
|
||||
pixbuf = l->data;
|
||||
|
||||
@ -4106,6 +4121,7 @@ gdk_window_set_icon_list (GdkWindow *window,
|
||||
}
|
||||
|
||||
l = g_list_next (l);
|
||||
n--;
|
||||
}
|
||||
|
||||
if (size > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user