From c70cdeed74158ac8e196cac9984bfb642ab0f601 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Wed, 3 Jul 2024 08:40:40 -0400 Subject: [PATCH] mainwindow: Correctly remove cards when they go away The reference is owned by the VBox, so we remove it there and it gets cleaned up, like other widgets. Fixes: https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/issues/162 Part-of: --- src/mainwindow.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 0ce7640..f834e18 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -1272,7 +1272,7 @@ void MainWindow::removeCard(uint32_t index) { if (!cardWidgets.count(index)) return; - delete cardWidgets[index]; + cardsVBox->remove(*cardWidgets[index]); cardWidgets.erase(index); updateDeviceVisibility(); }