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/links | |
| 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/links')
| -rw-r--r-- | src/modules/links/libkvilinks.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/modules/links/libkvilinks.cpp b/src/modules/links/libkvilinks.cpp index 5508d5e05..1f779032a 100644 --- a/src/modules/links/libkvilinks.cpp +++ b/src/modules/links/libkvilinks.cpp @@ -87,9 +87,8 @@ static bool links_module_init(KviModule * m) static bool links_module_cleanup(KviModule *) { - for(auto & l : g_pLinksWindowList) - l->die(); - g_pLinksWindowList.clear(); + while (!g_pLinksWindowList.empty()) + (*g_pLinksWindowList.begin())->die(); return true; } |
