diff options
| author | 2016-08-08 04:50:34 -0400 | |
|---|---|---|
| committer | 2016-08-08 04:50:34 -0400 | |
| commit | 66de67769296eff3d535f91d80fa3c97cd11cf7a (patch) | |
| tree | 3ac87b1f026dec04e6bfde38bdf4daf894ea51f7 /src/modules/socketspy/libkvisocketspy.cpp | |
| parent | DccChatWindow: Fix possible issue in tryFlushOutBuffers() (diff) | |
| download | KVIrc-66de67769296eff3d535f91d80fa3c97cd11cf7a.tar.gz KVIrc-66de67769296eff3d535f91d80fa3c97cd11cf7a.tar.bz2 KVIrc-66de67769296eff3d535f91d80fa3c97cd11cf7a.zip | |
void range-for loops when things are being destroyed
Otherwise, the iterator gets invalidated and undefined behaviour
can occur.
Diffstat (limited to 'src/modules/socketspy/libkvisocketspy.cpp')
| -rw-r--r-- | src/modules/socketspy/libkvisocketspy.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
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; } |
