From 66de67769296eff3d535f91d80fa3c97cd11cf7a Mon Sep 17 00:00:00 2001 From: staticfox Date: Mon, 8 Aug 2016 04:50:34 -0400 Subject: void range-for loops when things are being destroyed Otherwise, the iterator gets invalidated and undefined behaviour can occur. --- src/modules/socketspy/libkvisocketspy.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/modules/socketspy/libkvisocketspy.cpp') diff --git a/src/modules/socketspy/libkvisocketspy.cpp b/src/modules/socketspy/libkvisocketspy.cpp index 0a76aa806..6abb45168 100644 --- a/src/modules/socketspy/libkvisocketspy.cpp +++ b/src/modules/socketspy/libkvisocketspy.cpp @@ -66,9 +66,8 @@ static bool socketspy_module_init(KviModule * m) static bool socketspy_module_cleanup(KviModule *) { - for(auto & s : g_pSocketSpyWindowList) - s->die(); - g_pSocketSpyWindowList.clear(); + while(!g_pSocketSpyWindowList.empty()) + (*g_pSocketSpyWindowList.begin())->die(); return true; } -- cgit v1.3.1-10-gc9f91