summaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-10 13:54:17 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-10 13:54:17 -0300
commit45f80afc1f186f65dad95b54f4fba502a5933884 (patch)
tree4349785ce0e8e215388777a09b3b992a8cdef030 /qt-ui/profilegraphics.cpp
parent3eac2360e7173580c7325ccb9814be538d3ee078 (diff)
downloadsubsurface-45f80afc1f186f65dad95b54f4fba502a5933884.tar.gz
Fix memory leak
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/profilegraphics.cpp')
-rw-r--r--qt-ui/profilegraphics.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 98d542788..551b2d8dc 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -221,10 +221,14 @@ void ProfileGraphicsView::showEvent(QShowEvent* event)
void ProfileGraphicsView::clear()
{
- scene()->clear();
resetTransform();
zoomLevel = 0;
- toolTip = 0;
+ if(toolTip){
+ scene()->removeItem(toolTip);
+ toolTip->deleteLater();
+ toolTip = 0;
+ }
+ scene()->clear();
}
void ProfileGraphicsView::refresh()
@@ -291,7 +295,7 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
plot_temperature_profile();
/* Cylinder pressure plot */
- plot_cylinder_pressure(dive, dc);
+ plot_cylinder_pressure(dc);
/* Text on top of all graphs.. */
plot_temperature_text();
@@ -708,7 +712,7 @@ void ProfileGraphicsView::plot_single_temp_text(int sec, int mkelvin)
plot_text(&tro, QPointF(sec, mkelvin), QString("%1%2").arg(deg, 0, 'f', 1).arg(unit)); //"%.2g%s"
}
-void ProfileGraphicsView::plot_cylinder_pressure(struct dive *dive, struct divecomputer *dc)
+void ProfileGraphicsView::plot_cylinder_pressure(struct divecomputer *dc)
{
int i;
int last = -1, last_index = -1;
@@ -1366,6 +1370,12 @@ ToolTipItem::ToolTipItem(QGraphicsItem* parent): QGraphicsPathItem(parent), back
setZValue(99);
}
+ToolTipItem::~ToolTipItem()
+{
+ clear();
+}
+
+
void ToolTipItem::updateTitlePosition()
{
if (rectangle.width() < title->boundingRect().width() + SPACING*4) {
@@ -1399,7 +1409,6 @@ bool ToolTipItem::isExpanded() {
return status == EXPANDED;
}
-
EventItem::EventItem(QGraphicsItem* parent): QGraphicsPolygonItem(parent)
{
setFlag(ItemIgnoresTransformations);