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/term | |
| 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/term')
| -rw-r--r-- | src/modules/term/libkviterm.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/modules/term/libkviterm.cpp b/src/modules/term/libkviterm.cpp index 2b11b9ccd..4c56d5f1d 100644 --- a/src/modules/term/libkviterm.cpp +++ b/src/modules/term/libkviterm.cpp @@ -97,13 +97,11 @@ static bool term_module_init(KviModule * m) static bool term_module_cleanup(KviModule *) { #ifdef COMPILE_KDE4_SUPPORT - for(auto & t : g_pTermWidgetList) - delete t; - g_pTermWidgetList.clear(); + while(!g_pTermWidgetList.empty()) + delete *g_pSocketSpyWindowList.begin(); - for(auto & t : g_pTermWindowList) - t->close(); - g_pTermWindowList.clear(); + while(!g_pTermWindowList.empty()) + (*g_pTermWindowList.begin())->close(); #endif return true; } |
