From b6d476241a24866f8f7b92e849450450485a5b2f Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Fri, 17 Feb 2023 18:20:50 -0800 Subject: [PATCH] CodeViewWidget: Fix memory leak Per https://doc.qt.io/qt-6/qabstractitemview.html#setItemDelegateForColumn setItemDelegateForColumn does not take ownership of the parameter, so it was not being deleted. Specifying a parent to QObject (via QStyledItemDelegate's constructor) will allow it to automatically be deleted, per https://doc.qt.io/qt-6/objecttrees.html. The other instance of a QItemDelegate in IOWindow.cpp already used this. --- Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp index e843420b1e..15c76289b4 100644 --- a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp @@ -51,7 +51,7 @@ constexpr u32 WIDTH_PER_BRANCH_ARROW = 16; class BranchDisplayDelegate : public QStyledItemDelegate { public: - BranchDisplayDelegate(CodeViewWidget* parent) : m_parent(parent) {} + BranchDisplayDelegate(CodeViewWidget* parent) : QStyledItemDelegate(parent), m_parent(parent) {} private: CodeViewWidget* m_parent;