Created attachment 2399 [details] gtk2-adjust-logic-in-image_viewer_load_image.patch The function gdk_pixbuf_animation_new_from_stream may return NULL. Take the branch only if animation is valid. image_viewer.c: In function 'image_viewer_load_image': image_viewer.c:105:16: warning: suggest parentheses around '&&' within '||' [-Wparentheses] if (animation && gdk_pixbuf_animation_is_static_image(animation) Fixes commit 05f600e5826ab4fd43e345b87bf1029c1fef48f7 Fixes commit e121fc4767e57fd6018997b75d636264049c9ce8 Fixes commit d006355369916eefff3d964d4606e183339418aa
Created attachment 2400 [details] master-adjust-logic-in-image_viewer_load_image.patch
Hi Olaf, the API doc for gdk_pixbuf_animation_new_from_stream says [1]: > If NULL is returned, then error will be set. And the error is checked after call, therefore should be not possible to reach the patched line with a NULL value in the animation variable. That makes the check for animation nullness also unnecessary :) [1] https://docs.gtk.org/gdk-pixbuf/ctor.PixbufAnimation.new_from_stream.html
If that is the case, the check for animation==NULL could be removed. I think it needs careful reading of gdk_pixbuf_animation_new_from_stream, if it does indeed behave as documented in every code path.
I think the intention of 05f600e5826ab4fd43e345b87bf1029c1fef48f7 and e121fc4767e57fd6018997b75d636264049c9ce8 was a warning from coverity, which can not know that gdk_pixbuf_animation_new_from_stream reports errors via the return value and the value of "error". Therefore I think my change fixes the compiler warning, the coverity warning and potential errors in gdk_pixbuf_animation_new_from_stream.