gdk/win32/gdkwindow-win32.c: Fix gdk_win32_window_set_icon_list()

The list of surfaces passed into the function may be NULL, so don't try
to initialize the surfaces if it is so, to avoid a crash.

Also, remove the cast to GdkPixbuf* for getting surfaces->data, as we
are already using a cairo_surface_t*.

https://bugzilla.gnome.org/show_bug?id=773299
This commit is contained in:
Chun-wei Fan 2017-10-24 16:09:17 +08:00
parent a65730f38f
commit 006207e95e

View File

@ -2328,7 +2328,7 @@ gdk_win32_window_set_icon_list (GdkWindow *window,
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
if (GDK_WINDOW_DESTROYED (window) || surfaces == NULL)
return;
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
@ -2344,9 +2344,10 @@ gdk_win32_window_set_icon_list (GdkWindow *window,
small_surface = NULL;
big_diff = 0;
small_diff = 0;
while (surfaces)
{
surface = (GdkPixbuf*) surfaces->data;
surface = surfaces->data;
w = cairo_image_surface_get_width (surface);
h = cairo_image_surface_get_height (surface);