mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-01-09 11:50:16 +00:00
GUI: attachments: fix deleting attachments
The page was removed from the view and deleted, but it wasn't removed from the model's internal list of pages. Therefore the it got deleted a second time upon model reset leading to a segfault.
This commit is contained in:
parent
1dd074c9ea
commit
858b101513
@ -50,6 +50,18 @@ PageModel::appendPage(PageBase *page,
|
||||
m_topLevelPages << page;
|
||||
}
|
||||
|
||||
bool
|
||||
PageModel::deletePage(PageBase *page) {
|
||||
auto idx = m_pages.indexOf(page);
|
||||
if (idx == -1)
|
||||
return false;
|
||||
|
||||
m_pages.removeAt(idx);
|
||||
delete page;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<PageBase *> &
|
||||
PageModel::pages() {
|
||||
return m_pages;
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
PageBase *selectedPage(QModelIndex const &idx) const;
|
||||
|
||||
void appendPage(PageBase *page, QModelIndex const &parentIdx = {});
|
||||
bool deletePage(PageBase *page);
|
||||
|
||||
QList<PageBase *> &pages();
|
||||
QList<PageBase *> &topLevelPages();
|
||||
|
@ -633,8 +633,7 @@ Tab::removeSelectedAttachment() {
|
||||
m_model->removeRow(idx.row(), idx.parent());
|
||||
|
||||
m_attachmentsPage->m_children.removeAll(selectedPage);
|
||||
|
||||
delete selectedPage;
|
||||
m_model->deletePage(selectedPage);
|
||||
}
|
||||
|
||||
KaxAttachedPtr
|
||||
|
Loading…
Reference in New Issue
Block a user