From f1d8ce177f64788af199f5ce234392bed73d0a3b Mon Sep 17 00:00:00 2001 From: thickbrick Date: Wed, 13 Apr 2011 17:05:43 +0300 Subject: Fix #869: Fixed failure path for j2c decode, from Siana Gearz - Sets base.mDecoding to false on failure (from Snowglobe.) - Handle those failures in the image pipeline (research and patch by Siana Gearz / Singularity.) --- linden/indra/llimage/llimageworker.cpp | 2 +- linden/indra/llimagej2coj/llimagej2coj.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/linden/indra/llimage/llimageworker.cpp b/linden/indra/llimage/llimageworker.cpp index dc989e5..5e61f69 100644 --- a/linden/indra/llimage/llimageworker.cpp +++ b/linden/indra/llimage/llimageworker.cpp @@ -164,7 +164,7 @@ void LLImageDecodeThread::ImageRequest::finishRequest(bool completed) { if (mResponder.notNull()) { - bool success = completed && mDecodedRaw && (!mNeedsAux || mDecodedAux); + bool success = completed && mDecodedRaw && mDecodedImageRaw->getDataSize() && (!mNeedsAux || mDecodedAux); mResponder->completed(success, mDecodedImageRaw, mDecodedImageAux); } // Will automatically be deleted diff --git a/linden/indra/llimagej2coj/llimagej2coj.cpp b/linden/indra/llimagej2coj/llimagej2coj.cpp index b7a1b82..f003d60 100644 --- a/linden/indra/llimagej2coj/llimagej2coj.cpp +++ b/linden/indra/llimagej2coj/llimagej2coj.cpp @@ -170,6 +170,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod if(!image) { LL_DEBUGS("Openjpeg") << "ERROR -> decodeImpl: failed to decode image - no image" << LL_ENDL; + base.decodeFailed(); return TRUE; // done } @@ -183,6 +184,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod opj_image_destroy(image); } + base.decodeFailed(); return TRUE; // done } @@ -194,7 +196,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod // if we didn't get the discard level we're expecting, fail if (image) //anyway somthing odd with the image, better check than crash opj_image_destroy(image); - base.mDecoding = FALSE; + base.decodeFailed(); return TRUE; } } @@ -207,6 +209,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod opj_image_destroy(image); } + base.decodeFailed(); return TRUE; } @@ -254,6 +257,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod llwarns << "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)" << llendl; opj_image_destroy(image); + base.decodeFailed(); return TRUE; // done } } -- cgit v1.1