From fe554ceee3ee3d193724eae67a2f164feeb119d6 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Sun, 19 Nov 2023 14:14:05 +0800 Subject: [PATCH] ui/controls.cc: fix QLabel leak (#30382) fix QLabel leak old-commit-hash: 17cab9bb508c74471d0ec66c4a3358122afe52aa --- selfdrive/ui/qt/widgets/controls.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/qt/widgets/controls.cc b/selfdrive/ui/qt/widgets/controls.cc index 87304a4585..18a79b5983 100644 --- a/selfdrive/ui/qt/widgets/controls.cc +++ b/selfdrive/ui/qt/widgets/controls.cc @@ -12,13 +12,14 @@ AbstractControl::AbstractControl(const QString &title, const QString &desc, cons hlayout->setSpacing(20); // left icon - icon_label = new QLabel(); + icon_label = new QLabel(this); + hlayout->addWidget(icon_label); if (!icon.isEmpty()) { icon_pixmap = QPixmap(icon).scaledToWidth(80, Qt::SmoothTransformation); icon_label->setPixmap(icon_pixmap); icon_label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - hlayout->addWidget(icon_label); } + icon_label->setVisible(!icon.isEmpty()); // title title_label = new QPushButton(title);