Fix problems discovered by coverity (and more):

- Better handling of data pointer and errors for compressed data in kitty protocol
- Correct handling of iterator when erasing a placement.
- Use midRef() instead of mid().
This commit is contained in:
Matan Ziv-Av
2022-03-07 01:07:15 +02:00
committed by Kurt Hindenburg
parent 1341088b8b
commit d28359124b
2 changed files with 43 additions and 27 deletions

View File

@@ -1979,8 +1979,7 @@ void Screen::scrollUpVisiblePlacements(int n)
void Screen::delPlacements(int del, qint64 id, qint64 pid, int x, int y, int z)
{
std::vector<std::unique_ptr<TerminalGraphicsPlacement_t>>::iterator i;
i = _graphicsPlacements.begin();
auto i = _graphicsPlacements.begin();
while (i != _graphicsPlacements.end()) {
TerminalGraphicsPlacement_t *placement = i->get();
bool remove = false;
@@ -2026,7 +2025,7 @@ void Screen::delPlacements(int del, qint64 id, qint64 pid, int x, int y, int z)
break;
}
if (remove) {
_graphicsPlacements.erase(i);
i = _graphicsPlacements.erase(i);
} else {
i++;
}