summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divelistview.h
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-10-03 23:16:15 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-10-03 15:43:03 -0700
commite3118d915cf49de4cc722522031b0be44014d790 (patch)
treeb811197cc821adcd676eec408ba3ff6d296f54ad /desktop-widgets/divelistview.h
parent53c1c3f26bec6bf1d9f5417d5db12ea532c6a5cc (diff)
downloadsubsurface-e3118d915cf49de4cc722522031b0be44014d790.tar.gz
divelist: prevent a crash for missing column width
The `static int defaultWidth[]` definition in divelistview.cpp could potentially end up missing an element which can later result in out-of-bounds access when iterating through the list of columns and updating their widths. Add a couple of methods in DiveTripModel for setting and getting the widths and use those. The default values are now pre-set in a QVector in the DiveTripModel() constructor. Throw warnings if out-of-bounds columns are requested. Reported-by: Gaetan Bisson <bisson@archlinux.org> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'desktop-widgets/divelistview.h')
-rw-r--r--desktop-widgets/divelistview.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/desktop-widgets/divelistview.h b/desktop-widgets/divelistview.h
index 5081c8a07..7d3b78cc1 100644
--- a/desktop-widgets/divelistview.h
+++ b/desktop-widgets/divelistview.h
@@ -70,6 +70,7 @@ private:
QModelIndex contextMenuIndex;
bool dontEmitDiveChangedSignal;
bool selectionSaved;
+ DiveTripModel *tripModel;
/* if dive_trip_t is null, there's no problem. */
QMultiHash<dive_trip_t *, int> selectedDives;