[gtk+] gdk/win32/gdkwindow-win32.c: Fix gdk_win32_window_set_icon_list()



commit 006207e95e66075db6b088a4be1d25de0fb14f35
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Oct 24 16:09:17 2017 +0800

    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

 gdk/win32/gdkwindow-win32.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 65402ba..07e5255 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]