Dmitry Timoshkov <dmitry(a)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(a)winehq.org