GNOME Bugzilla – Bug 789870
gtk+4, GtkWindow: Several bugs when icon became a cairo_surface_t
Last modified: 2017-11-03 19:08:11 UTC
gtkwindow.c was not enough modified when the window icon was changed from a GdkPixbuf to a cairo_surface_t. gtk_window_set_property(), case PROP_ICON: g_value_get_object() shall be g_value_get_boxed(). gtk_window_get_property(), case PROP_ICON: g_value_set_object() shall be g_value_set_boxed(). icon_from_list(): Callers expect this function to add a reference to the returned icon, but this is missing in one place. Change best = (cairo_surface_t *)list->data; to best = cairo_surface_reference ((cairo_surface_t *)list->data); gtk_window_set_icon(): g_return_if_fail (icon == NULL); makes it impossible to set an icon with this function. Either remove that statement or replace it with g_return_if_fail (icon == NULL || cairo_surface_get_type (icon) == CAIRO_SURFACE_TYPE_IMAGE); in analogy with what gtk_window_set_default_icon() does.
Thanks for your bug report. Care to prepare a patch fixing all the instances you've identified? That would speed up fixing the issue.
Created attachment 362915 [details] [review] patch: GtkWindow: Tidy up after icon became a cairo surface This patch replaces g_return_if_fail (icon == NULL); with g_return_if_fail (icon == NULL || cairo_surface_get_type (icon) == CAIRO_SURFACE_TYPE_IMAGE); If you prefer to have it removed, I can make a new patch.
Review of attachment 362915 [details] [review]: thanks, looks good