forked from OpenGamers/abaddon
remove temporary image file when attachment removed
This commit is contained in:
parent
c6182e8923
commit
d7177cac97
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user