[PATCH] user32: Add support for PNG icons.

Alexandre Julliard julliard at winehq.org
Mon Apr 2 04:08:59 CDT 2018


Dmitry Timoshkov <dmitry at baikal.ru> writes:

> +static BOOL create_png_decoder(struct png_wrapper *png)
> +{
> +    jmp_buf jmpbuf;
> +    int color_type, bit_depth;
> +
> +    if (!load_libpng()) return FALSE;
> +
> +    /* initialize libpng */
> +    png->png_ptr = ppng_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
> +    if (!png->png_ptr) return FALSE;
> +
> +    png->info_ptr = ppng_create_info_struct(png->png_ptr);
> +    if (!png->info_ptr)
> +    {
> +        ppng_destroy_read_struct(&png->png_ptr, NULL, NULL);
> +        return FALSE;
> +    }
> +
> +    /* set up setjmp/longjmp error handling */
> +    if (setjmp(jmpbuf))
> +    {
> +        ppng_destroy_read_struct(&png->png_ptr, &png->info_ptr, NULL);
> +        return FALSE;
> +    }

You cannot do the setjmp in a helper function that you return from. All
the calls that can cause a longjmp need to be done inside that function.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list