Menu

#336 Segmentation fault with multiaxes branch

None
closed
nobody
None
5
2021-10-03
2021-08-30
Anonymous
No

QwtPlot::setAxesCount with num_axis > 2 causes segmentation fault.
The problem is probably generated in by QwtPlot::ScaleData::setAxesCount at line 101 where axisData gets resized.
QVector resize calls the default constructor of AxisData where a pointer to new QwtLinearScaleEngine gets saved in the scaleEngine variable.
The problem is that after storing a copy the AxisData Object in the Vector, the local copy of the object get destroyed and the scaleEngine is deleted in its destructor. The copy of the AxisData Object in the QVector referring to the deleted object is now invalid and causes segmentation fault when used or deleted (in the destructor or in setScaleEngine).

Discussion

  • Uwe Rathmann

    Uwe Rathmann - 2021-10-03

    AxisData needs to be declared as Q_MOVABLE_TYPE to avoid the accidental new/delete calls. Fixed in the multiaxes branch

     
  • Uwe Rathmann

    Uwe Rathmann - 2021-10-03
    • status: open --> closed
    • Group: -->
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB