diff options
-rw-r--r-- | src/runxdg.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/runxdg.cpp b/src/runxdg.cpp index 3ff942c..f47c6aa 100644 --- a/src/runxdg.cpp +++ b/src/runxdg.cpp @@ -28,6 +28,7 @@ #include <sys/time.h> #include <sys/wait.h> +#include <algorithm> #include <cstdio> #include "cpptoml/cpptoml.h" @@ -513,14 +514,10 @@ void POSIXLauncher::register_surfpid (pid_t surf_pid) void POSIXLauncher::unregister_surfpid (pid_t surf_pid) { - auto itr = m_pid_v.begin(); - while (itr != m_pid_v.end()) { - if (*itr == surf_pid) { - m_pid_v.erase(itr++); - } else { - ++itr; - } - } + auto beg = m_pid_v.begin(); + auto end = m_pid_v.end(); + m_pid_v.erase(std::remove(beg, end, surf_pid), end); + AGL_DEBUG("Unregistered surface (id=%d sz=%u)", surf_pid, m_pid_v.size()); } pid_t POSIXLauncher::find_surfpid_by_rid (pid_t rid) |