aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2023-10-30 22:06:02 +0100
committerfanquake <fanquake@gmail.com>2023-11-01 10:01:05 +0000
commite097d4cb5329e9037c0e66d1c71b1bc5a02d56e6 (patch)
treeb8b0935819102efd46626551583a7edbd1ad678f
parent05e887455454813465a2a5b376df672f199bfbf9 (diff)
gui: fix crash on selecting "Mask values" in transaction view
This commits fixes a crash bug that can be caused with the following steps: - change to the "Transactions" view - right-click on an arbitrary transaction -> "Show transaction details" - close the transaction detail window again - select "Settings" -> "Mask values" The problem is that the list of opened dialogs, tracked in the member variable `m_opened_dialogs`, is only ever appended with newly opened transaction detail dialog pointers, but never removed. This leads to dangling pointers in the list, and if the "Mask values" menu item is selected, a crash is caused in the course of trying to close the opened transaction detail dialogs (see `closeOpenedDialogs()` method). Fix this by removing the pointer from the list if the corresponding widget is destroyed. Github-Pull: https://github.com/bitcoin-core/gui/pull/774 Rebased-From: e26e665f9f64a962dd56053be817cc953e714847
-rw-r--r--src/qt/transactionview.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index 67af62285d..7e24dbd3ec 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -531,6 +531,9 @@ void TransactionView::showDetails()
TransactionDescDialog *dlg = new TransactionDescDialog(selection.at(0));
dlg->setAttribute(Qt::WA_DeleteOnClose);
m_opened_dialogs.append(dlg);
+ connect(dlg, &QObject::destroyed, [this, dlg] {
+ m_opened_dialogs.removeOne(dlg);
+ });
dlg->show();
}
}