[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-106-ge121fc476

wwp at claws-mail.org wwp at claws-mail.org
Fri Sep 3 07:21:29 UTC 2021


The branch, gtk3 has been updated
       via  e121fc4767e57fd6018997b75d636264049c9ce8 (commit)
      from  03d781d9fb4fba7b33b40293723fb3f7df40f017 (commit)

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


- Log -----------------------------------------------------------------
commit e121fc4767e57fd6018997b75d636264049c9ce8
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 a4273e9f2..5cbb8f787 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -95,14 +95,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);
@@ -111,7 +115,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,
@@ -123,15 +126,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;
 	}
 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list