Segfault and what's cylinder "use" used for in the planner?

Lubomir I. Ivanov neolit123 at gmail.com
Fri Apr 29 05:54:39 PDT 2016


On 29 April 2016 at 11:18, Rick Walsh <rickmwalsh at gmail.com> wrote:
>
> diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
> index 6e0abf0..350d15a 100644
> --- a/qt-models/cylindermodel.cpp
> +++ b/qt-models/cylindermodel.cpp
> @@ -274,7 +274,7 @@ bool CylindersModel::setData(const QModelIndex &index,
> const QVariant &value, in
>         case USE:
>                 if (CHANGED()) {
>                         int use = vString.toInt();
> -                       if (use > NUM_GAS_USE - 1)
> +                       if (use > NUM_GAS_USE - 1 || use < 0)
>                                 use = 0;
>                         cyl->cylinder_use = (enum cylinderuse)use;
>                         changed = true;
>

our clamp on the backend isn't optimal as the UI seems a bit broken.
the user has no idea what to write in that field...

at least with this patch, it won't read random adjacent memory (attached).

>> > but it's probably a good thing to also limit the user on the UI side -
>> > i.e. once a bad value is entered that field should be auto-adjusted to
>> > a good value.
>> >
>> Agreed. I think this should be a drop-down list. Or remove the field from
>> the table entirely. I couldn't work out if/how it's used at all.
>>

i've spent some time today, trying to make this into a combobox like
the one in the "Type" column, but i'm giving up as it doesn't work for
some reason...
BTW, there is something fishy about the item delegate used for the
"Use" column, as the source code reads that it's supposed to be a
combobox, already!

for now, i suggest that you file a bug report in the tracker.

lubomir
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-CylindersModel-clamp-the-cylinderuse-values.patch
Type: text/x-patch
Size: 1151 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160429/029073c9/attachment.bin>


More information about the subsurface mailing list