From 87edc756c9b1778cf0973272f9c3c370a74e9182 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sun, 30 Nov 2025 02:37:04 -0800 Subject: [PATCH] remove reparenting --- .../libcockatrice/models/deck_list/deck_list_model.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libcockatrice_models/libcockatrice/models/deck_list/deck_list_model.cpp b/libcockatrice_models/libcockatrice/models/deck_list/deck_list_model.cpp index 964d04aba..bd16ab3d2 100644 --- a/libcockatrice_models/libcockatrice/models/deck_list/deck_list_model.cpp +++ b/libcockatrice_models/libcockatrice/models/deck_list/deck_list_model.cpp @@ -5,8 +5,11 @@ DeckListModel::DeckListModel(QObject *parent) : QAbstractItemModel(parent), lastKnownColumn(1), lastKnownOrder(Qt::AscendingOrder) { + // This class will leak the decklist object. We cannot safely delete it in the dtor because the deckList field is a + // non-owning pointer and another deckList might have been assigned to it. + // `DeckListModel::cleanList` also leaks for the same reason. + // TODO: fix the leak deckList = new DeckList; - deckList->setParent(this); root = new InnerDecklistNode; }