[pulseaudio-commits] src/mainwindow.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 4 16:05:37 UTC 2021


 src/mainwindow.cc |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 381b708202e87e40347a57f8a627014199cde266
Author: Igor V. Kovalenko <igor.v.kovalenko at gmail.com>
Date:   Sat Dec 26 22:39:49 2020 +0300

    mainwindow: do not erase from container while iterating
    
    Part-of: <https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/merge_requests/53>

diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index d36cf57..f9cd16e 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -1260,18 +1260,18 @@ void MainWindow::removeClient(uint32_t index) {
 }
 
 void MainWindow::removeAllWidgets() {
-    for (std::map<uint32_t, SinkInputWidget*>::iterator it = sinkInputWidgets.begin(); it != sinkInputWidgets.end(); ++it)
-        removeSinkInput(it->first);
-    for (std::map<uint32_t, SourceOutputWidget*>::iterator it = sourceOutputWidgets.begin(); it != sourceOutputWidgets.end(); ++it)
-        removeSourceOutput(it->first);
-    for (std::map<uint32_t, SinkWidget*>::iterator it = sinkWidgets.begin(); it != sinkWidgets.end(); ++it)
-        removeSink(it->first);
-    for (std::map<uint32_t, SourceWidget*>::iterator it = sourceWidgets.begin(); it != sourceWidgets.end(); ++it)
-        removeSource(it->first);
-    for (std::map<uint32_t, CardWidget*>::iterator it = cardWidgets.begin(); it != cardWidgets.end(); ++it)
-       removeCard(it->first);
-    for (std::map<uint32_t, char*>::iterator it = clientNames.begin(); it != clientNames.end(); ++it)
-        removeClient(it->first);
+    while (!sinkInputWidgets.empty())
+        removeSinkInput(sinkInputWidgets.begin()->first);
+    while (!sourceOutputWidgets.empty())
+        removeSourceOutput(sourceOutputWidgets.begin()->first);
+    while (!sinkWidgets.empty())
+        removeSink(sinkWidgets.begin()->first);
+    while (!sourceWidgets.empty())
+        removeSource(sourceWidgets.begin()->first);
+    while (!cardWidgets.empty())
+        removeCard(cardWidgets.begin()->first);
+    while (!clientNames.empty())
+        removeClient(clientNames.begin()->first);
     deleteEventRoleWidget();
 }
 



More information about the pulseaudio-commits mailing list