mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
53c1c3f26b
commit
e3118d915c
4 changed files with 40 additions and 8 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue