From 04dbbab4a1f6ea9fe11231a01016b1ce8438ec7c Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 27 Feb 2026 19:26:12 +0300 Subject: [PATCH] Replaced vector container for SendFilesBox::Block with deque. SendFilesBox::Block (aka Block) passes action callbacks to AlbumPreview / SingleMediaPreview. These callbacks access Block::_items through a captured "this" pointer. With std::vector, _blocks.emplace_back() may reallocate and move existing Block objects. Callbacks already stored inside previews then keep a dangling Block*, and a later context-menu action can crash when reading this->_items. Switched _blocks to std::deque so existing element addresses stay stable on std::deque::push_back, keeping callback captures valid for previews. --- Telegram/SourceFiles/boxes/send_files_box.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/boxes/send_files_box.h b/Telegram/SourceFiles/boxes/send_files_box.h index 0e47358424..5582f6ea2c 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.h +++ b/Telegram/SourceFiles/boxes/send_files_box.h @@ -307,7 +307,7 @@ private: object_ptr _scroll; QPointer _inner; - std::vector _blocks; + std::deque _blocks; Fn _whenReadySend; bool _preparing = false;