Fix a crash on changing dives when the ruler is used.

The ruler is a weird beast - it has two child objects that access the
parent to call another function, that call the child functions.

When I updated the plot_info I didn't take that into consideration, what
happened is that when I set the parent's plot_info, the children's
plot_info are still invalid, but the update method is called anyhow.

This patch updates all plot_info's before calling anything else.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-03-07 12:08:31 -03:00 committed by Dirk Hohndel
parent 8034106219
commit 6dec4b0556
3 changed files with 18 additions and 10 deletions

View file

@ -15,15 +15,16 @@ class RulerNodeItem2 : public QObject, public QGraphicsEllipseItem {
friend class RulerItem2;
public:
explicit RulerNodeItem2(struct plot_info &info);
explicit RulerNodeItem2();
void setRuler(RulerItem2 *r);
void setPlotInfo(struct plot_info& info);
void recalculate();
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private:
struct plot_info &pInfo;
struct plot_info pInfo;
struct plot_data *entry;
RulerItem2 *ruler;
DiveCartesianAxis *timeAxis;