From 02fc95c70bab2e364b30dac5e66500b6204831ca Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Mon, 15 May 2023 20:21:06 +0200 Subject: [PATCH] Reset parent pointer when removing child from container and use the issuer as parent when inserting it to put it under the correct issuer --- lib/db_base.cpp | 1 + lib/db_x509.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/db_base.cpp b/lib/db_base.cpp index 227375a6..16e9ea62 100644 --- a/lib/db_base.cpp +++ b/lib/db_base.cpp @@ -75,6 +75,7 @@ void db_base::remFromCont(const QModelIndex &idx) beginRemoveRows(parent(idx), row, row); parent_pki->takeChild(pki); rootItem->takeChild(pki); + pki->setParent(nullptr); endRemoveRows(); emit columnsContentChanged(); } diff --git a/lib/db_x509.cpp b/lib/db_x509.cpp index 193788b4..7be323ba 100644 --- a/lib/db_x509.cpp +++ b/lib/db_x509.cpp @@ -122,7 +122,7 @@ void db_x509::remFromCont(const QModelIndex &idx) child = dynamic_cast(pki->takeFirst()); child->delSigner(dynamic_cast(pki)); new_parent = child->findIssuer(); - insertChild(child); + insertChild(child, new_parent); if (new_parent) childs << child; }