Segfault when trying to edit cylinder information

Thiago Macieira thiago at
Tue Jun 13 13:58:17 PDT 2017

On terça-feira, 13 de junho de 2017 13:16:21 PDT Lubomir I. Ivanov wrote:
> i cannot reproduce the problem, but also the above should not happen
> as we allocate the cylinder "type" (tank_info_t->name) on the heap and
> it's address cannot be so low (0x1770).

It comes from:

                struct tank_info_t *info = &tank_info[index.row()];

which is a global variable in core/equipment.c:

struct tank_info_t tank_info[100] = {

and has been so since 2013. I don't see how
 a) tank_info could be wrong (unless it's a major compilation problem)
 b) how index.row() could have been so exactly wrong to produce a pointer in 
    the second memory page (it's too much of a coincidence)

Not to mention that index was created by QComboBox, as a result of resize 
operation, so even if there's another QModelIndex in the stack, it shouldn't 
have had an effect -- not to mention that those were also generated by Qt.

Thiago Macieira - thiago (AT) - thiago (AT)
   Software Architect - Intel Open Source Technology Center

More information about the subsurface mailing list