mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: free plot data on exit
Some widgets copy the full plot info. Free these data on exit to prevent monstrous valgrind reports. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
05a5a06fd3
commit
4e86d99714
6 changed files with 18 additions and 0 deletions
|
@ -178,6 +178,11 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProfileWidget2::~ProfileWidget2()
|
||||||
|
{
|
||||||
|
free_plot_info_data(&plotInfo);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
void ProfileWidget2::addActionShortcut(const Qt::Key shortcut, void (ProfileWidget2::*slot)())
|
void ProfileWidget2::addActionShortcut(const Qt::Key shortcut, void (ProfileWidget2::*slot)())
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,6 +73,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
ProfileWidget2(QWidget *parent = 0);
|
ProfileWidget2(QWidget *parent = 0);
|
||||||
|
~ProfileWidget2();
|
||||||
void resetZoom();
|
void resetZoom();
|
||||||
void scale(qreal sx, qreal sy);
|
void scale(qreal sx, qreal sy);
|
||||||
void plotDive(const struct dive *d = 0, bool force = false, bool clearPictures = false, bool instant = false);
|
void plotDive(const struct dive *d = 0, bool force = false, bool clearPictures = false, bool instant = false);
|
||||||
|
|
|
@ -32,6 +32,11 @@ TankItem::TankItem(QObject *parent) :
|
||||||
hAxis = nullptr;
|
hAxis = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TankItem::~TankItem()
|
||||||
|
{
|
||||||
|
free(pInfoEntry);
|
||||||
|
}
|
||||||
|
|
||||||
void TankItem::setData(DivePlotDataModel *model, struct plot_info *plotInfo, struct dive *d)
|
void TankItem::setData(DivePlotDataModel *model, struct plot_info *plotInfo, struct dive *d)
|
||||||
{
|
{
|
||||||
// If there is nothing to plot, quit early.
|
// If there is nothing to plot, quit early.
|
||||||
|
|
|
@ -15,6 +15,7 @@ class TankItem : public QObject, public QGraphicsRectItem
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TankItem(QObject *parent = 0);
|
explicit TankItem(QObject *parent = 0);
|
||||||
|
~TankItem();
|
||||||
void setHorizontalAxis(DiveCartesianAxis *horizontal);
|
void setHorizontalAxis(DiveCartesianAxis *horizontal);
|
||||||
void setData(DivePlotDataModel *model, struct plot_info *plotInfo, struct dive *d);
|
void setData(DivePlotDataModel *model, struct plot_info *plotInfo, struct dive *d);
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,11 @@ DivePlotDataModel::DivePlotDataModel(QObject *parent) :
|
||||||
memset(&plot_deco_state, 0, sizeof(struct deco_state));
|
memset(&plot_deco_state, 0, sizeof(struct deco_state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DivePlotDataModel::~DivePlotDataModel()
|
||||||
|
{
|
||||||
|
free_plot_info_data(&pInfo);
|
||||||
|
}
|
||||||
|
|
||||||
int DivePlotDataModel::columnCount(const QModelIndex&) const
|
int DivePlotDataModel::columnCount(const QModelIndex&) const
|
||||||
{
|
{
|
||||||
return COLUMNS;
|
return COLUMNS;
|
||||||
|
|
|
@ -73,6 +73,7 @@ public:
|
||||||
COLUMNS
|
COLUMNS
|
||||||
};
|
};
|
||||||
explicit DivePlotDataModel(QObject *parent = 0);
|
explicit DivePlotDataModel(QObject *parent = 0);
|
||||||
|
~DivePlotDataModel();
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue