diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-06-16 01:09:54 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-06-16 01:09:54 -0400 |
commit | d0fa308f6e339b94044d39bf0e76b8221da48c3a (patch) | |
tree | b8e54703587885856c7d939f213b14e62c737115 /src/components | |
parent | 4456c8771da668cbadb411583624fe0e357fa687 (diff) | |
download | abaddon-portaudio-d0fa308f6e339b94044d39bf0e76b8221da48c3a.tar.gz abaddon-portaudio-d0fa308f6e339b94044d39bf0e76b8221da48c3a.zip |
preserve attachment insertion order
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/chatinput.cpp | 5 | ||||
-rw-r--r-- | src/components/chatinput.hpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/components/chatinput.cpp b/src/components/chatinput.cpp index 2b8b5a5..5a6e71e 100644 --- a/src/components/chatinput.cpp +++ b/src/components/chatinput.cpp @@ -138,12 +138,13 @@ bool ChatInputAttachmentContainer::AddImage(const Glib::RefPtr<Gdk::Pixbuf> &pb) item->set_valign(Gtk::ALIGN_CENTER); m_box.add(*item); - m_attachments.insert(item); + m_attachments.push_back(item); item->signal_remove().connect([this, item] { std::error_code ec; std::filesystem::remove(item->GetPath(), ec); - m_attachments.erase(item); + if (auto it = std::find(m_attachments.begin(), m_attachments.end(), item); it != m_attachments.end()) + m_attachments.erase(it); delete item; if (m_attachments.empty()) m_signal_emptied.emit(); diff --git a/src/components/chatinput.hpp b/src/components/chatinput.hpp index ba3ab36..254f96f 100644 --- a/src/components/chatinput.hpp +++ b/src/components/chatinput.hpp @@ -41,7 +41,7 @@ public: [[nodiscard]] std::vector<ChatSubmitParams::Attachment> GetAttachments() const; private: - std::set<ChatInputAttachmentItem *> m_attachments; + std::vector<ChatInputAttachmentItem *> m_attachments; Gtk::Box m_box; |