[pulseaudio-commits] [Git][pulseaudio/pavucontrol][master] mainwindow: do not erase from container while iterating

PulseAudio Marge Bot gitlab at gitlab.freedesktop.org
Mon Jan 4 16:05:37 UTC 2021



PulseAudio Marge Bot pushed to branch master at PulseAudio / pavucontrol


Commits:
381b7082 by Igor V. Kovalenko at 2021-01-04T18:56:17+03:00
mainwindow: do not erase from container while iterating

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/merge_requests/53>

- - - - -


1 changed file:

- src/mainwindow.cc


Changes:

=====================================
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();
 }
 



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/commit/381b708202e87e40347a57f8a627014199cde266

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/commit/381b708202e87e40347a57f8a627014199cde266
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20210104/9ff86541/attachment-0001.htm>


More information about the pulseaudio-commits mailing list