diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-10-04 21:11:56 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-10-05 10:08:27 +0300 |
commit | 85b7210fb9f849633b27a4b4631c42ae7dba78f2 (patch) | |
tree | 2a722176fff0ac2511b5951603591e8cb80af557 | |
parent | da341eb2daa361ffb974e2593a217778dfbb3383 (diff) |
viewer#2741 Sligtly better logging for a crash
-rw-r--r-- | indra/llrender/llimagegl.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 67b4ada62f..abbf90bf59 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1323,12 +1323,16 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt { //GL_ALPHA is deprecated, convert to RGBA if (pixels != nullptr) { - scratch.reset(new(std::nothrow) U32[width * height]); - if (!scratch) + try + { + scratch.reset(new U32[width * height]); + } + catch (std::bad_alloc) { LLError::LLUserWarningMsg::showOutOfMemory(); LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32)) - << " bytes for a manual image W" << width << " H" << height << LL_ENDL; + << " bytes for a manual image W" << width << " H" << height + << " Pixformat: GL_ALPHA, pixtype: GL_UNSIGNED_BYTE" << LL_ENDL; } U32 pixel_count = (U32)(width * height); @@ -1350,12 +1354,16 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt { //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA if (pixels != nullptr) { - scratch.reset(new(std::nothrow) U32[width * height]); - if (!scratch) + try + { + scratch.reset(new U32[width * height]); + } + catch (std::bad_alloc) { LLError::LLUserWarningMsg::showOutOfMemory(); LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32)) - << " bytes for a manual image W" << width << " H" << height << LL_ENDL; + << " bytes for a manual image W" << width << " H" << height + << " Pixformat: GL_LUMINANCE_ALPHA, pixtype: GL_UNSIGNED_BYTE" << LL_ENDL; } U32 pixel_count = (U32)(width * height); @@ -1380,12 +1388,16 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt { //GL_LUMINANCE_ALPHA is deprecated, convert to RGB if (pixels != nullptr) { - scratch.reset(new(std::nothrow) U32[width * height]); - if (!scratch) + try + { + scratch.reset(new U32[width * height]); + } + catch (std::bad_alloc) { LLError::LLUserWarningMsg::showOutOfMemory(); LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32)) - << " bytes for a manual image W" << width << " H" << height << LL_ENDL; + << " bytes for a manual image W" << width << " H" << height + << " Pixformat: GL_LUMINANCE, pixtype: GL_UNSIGNED_BYTE" << LL_ENDL; } U32 pixel_count = (U32)(width * height); |