summaryrefslogtreecommitdiff
path: root/src/components/chatinput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/chatinput.cpp')
-rw-r--r--src/components/chatinput.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/chatinput.cpp b/src/components/chatinput.cpp
index 94bca22..7597bbe 100644
--- a/src/components/chatinput.cpp
+++ b/src/components/chatinput.cpp
@@ -104,8 +104,11 @@ ChatInputAttachmentContainer::ChatInputAttachmentContainer()
}
void ChatInputAttachmentContainer::Clear() {
- for (auto *x : m_attachments)
- delete x;
+ for (auto *item : m_attachments) {
+ std::error_code ec;
+ std::filesystem::remove(item->GetPath(), ec);
+ delete item;
+ }
m_attachments.clear();
}
@@ -137,6 +140,8 @@ bool ChatInputAttachmentContainer::AddImage(const Glib::RefPtr<Gdk::Pixbuf> &pb)
m_attachments.insert(item);
item->signal_remove().connect([this, item] {
+ std::error_code ec;
+ std::filesystem::remove(item->GetPath(), ec);
m_attachments.erase(item);
delete item;
if (m_attachments.empty())