filethumbnail: Clear image on failure
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 28 Feb 2023 16:52:12 +0000 (13:52 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 28 Feb 2023 16:52:12 +0000 (13:52 -0300)
Unset the image if we fail to find the appropriate icon, regardless
of the reason of the failure. Prevents the thumbnail to misrepresent
the GFileInfo it's supposed to represent.

gtk/gtkfilethumbnail.c

index 32035890271f264f0a03ab241d5bc616390c79ea..3e01484158609a82e52f3efb9f846094cd5308d7 100644 (file)
@@ -78,7 +78,10 @@ update_image (GtkFileThumbnail *self)
   int scale;
 
   if (!g_file_info_has_attribute (self->info, G_FILE_ATTRIBUTE_STANDARD_ICON))
-    return FALSE;
+    {
+      gtk_image_clear (GTK_IMAGE (self->image));
+      return FALSE;
+    }
 
   scale = gtk_widget_get_scale_factor (GTK_WIDGET (self));
   icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (self)));
@@ -128,7 +131,10 @@ static void
 get_thumbnail (GtkFileThumbnail *self)
 {
   if (!self->info)
-    return;
+    {
+      gtk_image_clear (GTK_IMAGE (self->image));
+      return;
+    }
 
   if (!update_image (self))
     {