From a85590dc71604399d70382e6f3b6127cfe245ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 1 Jul 2025 17:19:11 +0200 Subject: [PATCH] Text: ensure method call order in GlyphCacheGL::processedImage(). It worked correctly with local testing, but now I enabled llvmpipe for (desktop) GL testing on the CI where it's compiled with GCC 4.8 and *of course* image.release() gets called before image.size(), resulting in empty image being produced. I bet the same happens with MSVC, it's just that nobody discovered yet. --- src/Magnum/Text/GlyphCacheGL.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Text/GlyphCacheGL.cpp b/src/Magnum/Text/GlyphCacheGL.cpp index 36367eea2..61036f5d2 100644 --- a/src/Magnum/Text/GlyphCacheGL.cpp +++ b/src/Magnum/Text/GlyphCacheGL.cpp @@ -193,7 +193,11 @@ void GlyphCacheGL::doSetProcessedImage(const Vector2i& offset, const ImageView2D #ifndef MAGNUM_TARGET_GLES Image3D GlyphCacheGL::doProcessedImage() { Image2D out = static_cast(*_state).texture.image(0, processedFormat()); - return Image3D{out.format(), {out.size(), 1}, out.release()}; + /* Explicitly query size before calling release() to ensure the compiler + doesn't call first release() and then size() if they'd be in a single + expression, resulting in an image of zero dimensions */ + const Vector3i size{out.size(), 1}; + return Image3D{out.format(), size, out.release()}; } #endif