diff options
author | Evgeny Startsev <slayer-gurgen@yandex.ru> | 2015-07-22 19:16:33 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-07-22 19:16:33 +0100 |
commit | 1b587ca868ee75758959c2470a9c35a21299377f (patch) | |
tree | 0e20753102e8c1db3b0815830a072ec14f18b715 /gui | |
parent | 11b6bfa7620f31b9c2bc2e537b66233daf5e192f (diff) |
gui: Fix erasing elements from list during iteration.
Fixes issue #357.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/apitrace.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gui/apitrace.cpp b/gui/apitrace.cpp index fe676ff5..3e449357 100644 --- a/gui/apitrace.cpp +++ b/gui/apitrace.cpp @@ -279,18 +279,19 @@ void ApiTrace::loaderFrameLoaded(ApiTraceFrame *frame, if (!m_queuedErrors.isEmpty()) { QList< QPair<ApiTraceFrame*, ApiTraceError> >::iterator itr; - for (itr = m_queuedErrors.begin(); itr != m_queuedErrors.end(); - ++itr) { + itr = m_queuedErrors.begin(); + while (itr != m_queuedErrors.end()) { const ApiTraceError &error = (*itr).second; if ((*itr).first == frame) { ApiTraceCall *call = frame->callWithIndex(error.callIndex); if (!call) { + ++itr; continue; } call->setError(error.message); - m_queuedErrors.erase(itr); + itr = m_queuedErrors.erase(itr); if (call->hasError()) { m_errors.insert(call); @@ -298,6 +299,8 @@ void ApiTrace::loaderFrameLoaded(ApiTraceFrame *frame, m_errors.remove(call); } emit changed(call); + } else { + ++itr; } } } |