From dc4ad7a9d443ec7dcec235c8db1b597c496a5f8a Mon Sep 17 00:00:00 2001 From: Ramjdeemp Date: Tue, 20 Jan 2026 19:57:23 +0530 Subject: [PATCH] Avoid potential recursion in IconDelegate::paint The delegate previously forwarded painting to view->itemDelegate(), which may resolve back to the same delegate and risks recursion or reliance on undocumented behavior. This change calls QStyledItemDelegate::paint() directly, which is the documented and canonical approach for default item painting in Qt, ensuring correctness and predictable behavior. --- src/icondelegate.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/icondelegate.cpp b/src/icondelegate.cpp index bec7d995e..ce43316e0 100644 --- a/src/icondelegate.cpp +++ b/src/icondelegate.cpp @@ -77,11 +77,6 @@ void IconDelegate::paintIcons(QPainter* painter, const QStyleOptionViewItem& opt void IconDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { - if (auto* w = qobject_cast(parent())) { - w->itemDelegate()->paint(painter, option, index); - } else { - QStyledItemDelegate::paint(painter, option, index); - } - + QStyledItemDelegate::paint(painter, option, index); paintIcons(painter, option, index, getIcons(index)); }