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: <https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/merge_requests/98>
This commit is contained in:
Arun Raghavan 2024-07-03 08:40:40 -04:00
parent a9d7a65d82
commit c70cdeed74
1 changed files with 1 additions and 1 deletions

View File

@ -1272,7 +1272,7 @@ void MainWindow::removeCard(uint32_t index) {
if (!cardWidgets.count(index)) if (!cardWidgets.count(index))
return; return;
delete cardWidgets[index]; cardsVBox->remove(*cardWidgets[index]);
cardWidgets.erase(index); cardWidgets.erase(index);
updateDeviceVisibility(); updateDeviceVisibility();
} }