From: Jean-Marc Lasgouttes Date: Wed, 5 Apr 2017 08:20:01 +0000 (+0200) Subject: Replace coverity annotation by an assertion X-Git-Tag: 2.3.0alpha1~123 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=abc0aaec12dfe8c78cb32f28f6455ca9ec4ef6c2;p=features.git Replace coverity annotation by an assertion And reorganize the code a bit. --- diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 084377231f..4753b2b483 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -2037,17 +2037,18 @@ void TabWorkArea::updateTabTexts() continue; } - // we found a non-atomic segment segStart <= sit <= it < next. + // We found a non-atomic segment + // We know that segStart <= it < next <= paths.end(). + // The assertion below tells coverity about it. + LATTEST(segStart != paths.end()); + QString dspString = segStart->forecastPathString(); + LYXERR(Debug::GUI, "first forecast found for " + << segStart->abs() << " => " << dspString); + It sit = segStart; + ++sit; // Shift path segments and hope for the best // that it makes the path more unique. somethingChanged = true; - It sit = segStart; - // this is ok for the reason mentioned in the previous comment. - // coverity[INVALIDATE_ITERATOR] - QString dspString = sit->forecastPathString(); - LYXERR(Debug::GUI, "first forecast found for " - << sit->abs() << " => " << dspString); - ++sit; bool moreUnique = false; for (; sit != next; ++sit) { if (sit->forecastPathString() != dspString) {