[Commits] [SCM] claws branch, master, updated. 3.18.0-66-g05f600e58

wwp at claws-mail.org wwp at claws-mail.org
Fri Sep 3 07:17:33 UTC 2021


The branch, master has been updated
       via  05f600e5826ab4fd43e345b87bf1029c1fef48f7 (commit)
      from  45ac11d4db29610c0b66e53ecef8aaea1ebbbc9e (commit)

Summary of changes:
 src/image_viewer.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)


- Log -----------------------------------------------------------------
commit 05f600e5826ab4fd43e345b87bf1029c1fef48f7
Author: wwp <subscript at free.fr>
Date:   Fri Sep 3 09:17:04 2021 +0200

    CID1443020: logically dead code. Rework image loading error detection.

diff --git a/src/image_viewer.c b/src/image_viewer.c
index ca9e67c31..ca1ce3ed8 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -96,14 +96,18 @@ static void image_viewer_load_image(ImageViewer *imageviewer)
 #endif
 	g_object_unref(stream);
 
-	if (error != NULL) {
+	if (error) {
 		g_warning("Couldn't load image: %s\n", error->message);
+		gtk_label_set_text(GTK_LABEL(imageviewer->error_lbl), _("Error:"));
+		gtk_label_set_text(GTK_LABEL(imageviewer->error_msg), error->message);
+		gtk_notebook_set_current_page(GTK_NOTEBOOK(imageviewer->notebook), 0);
+		gtk_widget_hide(imageviewer->load_button);
 		g_error_free(error);
 		return;
 	}
 
 #if GDK_PIXBUF_MINOR >= 28
-	if (gdk_pixbuf_animation_is_static_image(animation)
+	if (animation && gdk_pixbuf_animation_is_static_image(animation)
 	    || imageviewer->resize_img || imageviewer->fit_img_height) {
 		pixbuf = gdk_pixbuf_animation_get_static_image(animation);
 		g_object_ref(pixbuf);
@@ -112,7 +116,6 @@ static void image_viewer_load_image(ImageViewer *imageviewer)
 #else
 	if (imageviewer->resize_img || imageviewer->fit_img_height) {
 #endif
-
 		if (imageviewer->resize_img) {
 			gtk_widget_get_allocation(imageviewer->scrolledwin, &allocation);
 			pixbuf = claws_load_pixbuf_fitting(pixbuf, FALSE,
@@ -124,15 +127,8 @@ static void image_viewer_load_image(ImageViewer *imageviewer)
 			pixbuf = claws_load_pixbuf_fitting(pixbuf, FALSE, imageviewer->fit_img_height, -1, -1);
 	}
 
-	if (error && !pixbuf && !animation) {
-		gtk_label_set_text(GTK_LABEL(imageviewer->error_lbl), _("Error:"));
-		gtk_label_set_text(GTK_LABEL(imageviewer->error_msg), error->message);
-		gtk_notebook_set_current_page(GTK_NOTEBOOK(imageviewer->notebook), 0);
-		gtk_widget_hide(imageviewer->load_button);
-		g_error_free(error);
-	}
 	if (!pixbuf && !animation) {
-		g_warning("Can't load the image.");	
+		g_warning("Couldn't load the image");	
 		return;
 	}
 
@@ -144,7 +140,6 @@ static void image_viewer_load_image(ImageViewer *imageviewer)
 	g_signal_handlers_block_by_func(G_OBJECT(imageviewer->scrolledwin), 
 			 G_CALLBACK(scrolledwin_resize_cb), imageviewer);
 
-
 	gtk_widget_show(imageviewer->image);
 	GTK_EVENTS_FLUSH();
 	g_signal_handlers_unblock_by_func(G_OBJECT(imageviewer->scrolledwin), 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list