[PATCH] Planner: fix an enduring assert on startup
Lubomir I. Ivanov
neolit123 at gmail.com
Sun Jul 20 06:18:00 PDT 2014
From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
qt 5.3, win7 64bit.
beginRemoveRows() asserts in removeSelectedPoints()
because rowCount() - 1, becomes less than firstRow.
This needs a check in removeSelectedPoints() if the number
of passed rows is zero.
Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
pretty much the first time i see the planner, because of this
assert; didn't have the time to investigate. but at least the
second time i fix a bug of this type - QAbstractItemModel's
beginRemoveRows() first >= last.
i have no idea why nobody else is seeing this; probably because
of my debug win7 build.
---
qt-ui/diveplanner.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 4ecf7a9..4f3655b 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -53,6 +53,8 @@ bool intLessThan(int a, int b)
}
void DivePlannerPointsModel::removeSelectedPoints(const QVector<int> &rows)
{
+ if (!rows.count())
+ return;
int firstRow = rowCount() - rows.count();
QVector<int> v2 = rows;
std::sort(v2.begin(), v2.end(), intLessThan);
--
1.7.11.msysgit.0
More information about the subsurface
mailing list