diff options
author | Chris Robinson <[email protected]> | 2023-12-29 03:39:58 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-29 03:39:58 -0800 |
commit | 10ecdff7d1dfcc16bd2a090f089781310ea9a93d (patch) | |
tree | ecd0f09a18f211ca7df2120e7c998aa037f5dfe4 /utils/alsoft-config | |
parent | 768781bab97732fbd0d66fa153d4ebc768be1240 (diff) |
Handle pointer ownership a bit better
Diffstat (limited to 'utils/alsoft-config')
-rw-r--r-- | utils/alsoft-config/mainwindow.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index b2412c73..9a65f79c 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -20,6 +20,7 @@ #include <shlobj.h> #endif +#include "almalloc.h" #include "alspan.h" namespace { @@ -1283,11 +1284,10 @@ void MainWindow::addHrtfFile() void MainWindow::removeHrtfFile() { - QList<QListWidgetItem*> selected{ui->hrtfFileList->selectedItems()}; + QList<gsl::owner<QListWidgetItem*>> selected{ui->hrtfFileList->selectedItems()}; if(!selected.isEmpty()) { - foreach(QListWidgetItem *item, selected) - delete item; + std::for_each(selected.begin(), selected.end(), std::default_delete<QListWidgetItem>{}); enableApplyButton(); } } @@ -1321,9 +1321,8 @@ void MainWindow::showEnabledBackendMenu(QPoint pt) QAction *gotAction{ctxmenu.exec(pt)}; if(gotAction == removeAction) { - QList<QListWidgetItem*> selected{ui->enabledBackendList->selectedItems()}; - foreach(QListWidgetItem *item, selected) - delete item; + QList<gsl::owner<QListWidgetItem*>> selected{ui->enabledBackendList->selectedItems()}; + std::for_each(selected.begin(), selected.end(), std::default_delete<QListWidgetItem>{}); enableApplyButton(); } else if(gotAction != nullptr) @@ -1359,9 +1358,8 @@ void MainWindow::showDisabledBackendMenu(QPoint pt) QAction *gotAction{ctxmenu.exec(pt)}; if(gotAction == removeAction) { - QList<QListWidgetItem*> selected{ui->disabledBackendList->selectedItems()}; - foreach(QListWidgetItem *item, selected) - delete item; + QList<gsl::owner<QListWidgetItem*>> selected{ui->disabledBackendList->selectedItems()}; + std::for_each(selected.begin(), selected.end(), std::default_delete<QListWidgetItem>{}); enableApplyButton(); } else if(gotAction != nullptr) |