JPEG: Factor out the middle of IMG_SaveJPG_RW_jpeglib
No functional change intended. We'll need to use setjmp() in this
function in a subsequent commit, so ensure that its state doesn't
include any local variables that are used both "above" and "below"
the stack level at which we will call setjmp().
JPEG: Add error-recovery when saving with libjpeg
Because we have set up libjpeg to use my_error_exit, we need to call
setjmp() before the first time it might possibly call longjmp().
Otherwise, on error we'll do a non-local goto to an uninitialized
pointer and crash.
SDL2 version of #431, which should be merged first (but this is the version that I have actually tested). Please cherry-pick to release-2.8.x if accepted.
JPEG: Factor out the middle of IMG_SaveJPG_RW_jpeglib
No functional change intended. We'll need to use setjmp() in this function in a subsequent commit, so ensure that its state doesn't include any local variables that are used both "above" and "below" the stack level at which we will call setjmp().
JPEG: Add error-recovery when saving with libjpeg
Because we have set up libjpeg to use my_error_exit, we need to call setjmp() before the first time it might possibly call longjmp(). Otherwise, on error we'll do a non-local goto to an uninitialized pointer and crash.
SDL2 version of #431, which should be merged first (but this is the version that I have actually tested). Please cherry-pick to release-2.8.x if accepted.