From 876f4823910327ed387e73ed88b051ea6216ab76 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 18 Dec 2024 21:12:20 +0100 Subject: [PATCH] fix sdl image loder io leak and send image popup fixes --- src/chat_gui/send_image_popup.cpp | 4 +++- src/image_loader_sdl_image.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/chat_gui/send_image_popup.cpp b/src/chat_gui/send_image_popup.cpp index 107b3cc..799126b 100644 --- a/src/chat_gui/send_image_popup.cpp +++ b/src/chat_gui/send_image_popup.cpp @@ -11,6 +11,8 @@ #include +#include + // fwd namespace Message { uint64_t getTimeMS(void); @@ -91,7 +93,7 @@ bool SendImagePopup::load(void) { preview_image.timestamp_last_rendered = Message::getTimeMS(); preview_image.current_texture = 0; for (const auto& [ms, data] : original_image.frames) { - const auto n_t = _tu.uploadRGBA(data.data(), original_image.width, original_image.height); + const auto n_t = _tu.upload(data.data(), original_image.width, original_image.height); preview_image.textures.push_back(n_t); preview_image.frame_duration.push_back(ms); } diff --git a/src/image_loader_sdl_image.cpp b/src/image_loader_sdl_image.cpp index 4800e36..c837eb4 100644 --- a/src/image_loader_sdl_image.cpp +++ b/src/image_loader_sdl_image.cpp @@ -55,6 +55,7 @@ ImageLoaderSDLImage::ImageInfo ImageLoaderSDLImage::loadInfoFromMemory(const uin // we ignore tga auto ext_opt = getExt(ios); if (!ext_opt.has_value()) { + SDL_CloseIO(ios); return res; } @@ -80,6 +81,7 @@ ImageLoaderSDLImage::ImageResult ImageLoaderSDLImage::loadFromMemoryRGBA(const u // we ignore tga auto ext_opt = getExt(ios); if (!ext_opt.has_value()) { + SDL_CloseIO(ios); return res; }