Disable LLImageJPEG setjmp hack when building on ARM to avoid crash
parent
fd94dc0cd0
commit
4a56738e4f
|
|
@ -31,7 +31,9 @@
|
|||
#include "llerror.h"
|
||||
#include "llexception.h"
|
||||
|
||||
#if !LL_ARM64
|
||||
jmp_buf LLImageJPEG::sSetjmpBuffer ;
|
||||
#endif
|
||||
LLImageJPEG::LLImageJPEG(S32 quality)
|
||||
: LLImageFormatted(IMG_CODEC_JPEG),
|
||||
mOutputBuffer( NULL ),
|
||||
|
|
@ -78,12 +80,15 @@ bool LLImageJPEG::updateData()
|
|||
//
|
||||
//try/catch will crash on Mac and Linux if LLImageJPEG::errorExit throws an error
|
||||
//so as instead, we use setjmp/longjmp to avoid this crash, which is the best we can get. --bao
|
||||
//except in the case of AARCH64/ARM64 where setjmp will crash
|
||||
//
|
||||
#if !LL_ARM64
|
||||
if(setjmp(sSetjmpBuffer))
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
try
|
||||
{
|
||||
// Now we can initialize the JPEG decompression object.
|
||||
|
|
@ -223,11 +228,13 @@ bool LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time)
|
|||
//try/catch will crash on Mac and Linux if LLImageJPEG::errorExit throws an error
|
||||
//so as instead, we use setjmp/longjmp to avoid this crash, which is the best we can get. --bao
|
||||
//
|
||||
#if !LL_ARM64
|
||||
if(setjmp(sSetjmpBuffer))
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
return true; // done
|
||||
}
|
||||
#endif
|
||||
try
|
||||
{
|
||||
// Now we can initialize the JPEG decompression object.
|
||||
|
|
@ -431,9 +438,10 @@ void LLImageJPEG::errorExit( j_common_ptr cinfo )
|
|||
|
||||
// Let the memory manager delete any temp files
|
||||
jpeg_destroy(cinfo);
|
||||
|
||||
#if !LL_ARM64
|
||||
// Return control to the setjmp point
|
||||
longjmp(sSetjmpBuffer, 1) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Decide whether to emit a trace or warning message.
|
||||
|
|
@ -545,6 +553,7 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time )
|
|||
//try/catch will crash on Mac and Linux if LLImageJPEG::errorExit throws an error
|
||||
//so as instead, we use setjmp/longjmp to avoid this crash, which is the best we can get. --bao
|
||||
//
|
||||
#if !LL_ARM64
|
||||
if( setjmp(sSetjmpBuffer) )
|
||||
{
|
||||
// If we get here, the JPEG code has signaled an error.
|
||||
|
|
@ -555,7 +564,7 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time )
|
|||
mOutputBufferSize = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
try
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,9 @@ protected:
|
|||
|
||||
S32 mEncodeQuality; // on a scale from 1 to 100
|
||||
private:
|
||||
#if !LL_ARM64
|
||||
static jmp_buf sSetjmpBuffer; // To allow the library to abort.
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // LL_LLIMAGEJPEG_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue