summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/diveeventitem.cpp8
-rw-r--r--profile-widget/diveeventitem.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp
index 0bbc84267..083c8b5b8 100644
--- a/profile-widget/diveeventitem.cpp
+++ b/profile-widget/diveeventitem.cpp
@@ -19,6 +19,10 @@ DiveEventItem::DiveEventItem(QObject *parent) : DivePixmapItem(parent),
setFlag(ItemIgnoresTransformations);
}
+DiveEventItem::~DiveEventItem()
+{
+ free(internalEvent);
+}
void DiveEventItem::setHorizontalAxis(DiveCartesianAxis *axis)
{
@@ -48,7 +52,9 @@ void DiveEventItem::setEvent(struct event *ev)
{
if (!ev)
return;
- internalEvent = ev;
+
+ free(internalEvent);
+ internalEvent = clone_event(ev);
setupPixmap();
setupToolTipString();
recalculatePos(true);
diff --git a/profile-widget/diveeventitem.h b/profile-widget/diveeventitem.h
index f358fee6d..9d6ad5d26 100644
--- a/profile-widget/diveeventitem.h
+++ b/profile-widget/diveeventitem.h
@@ -11,6 +11,7 @@ class DiveEventItem : public DivePixmapItem {
Q_OBJECT
public:
DiveEventItem(QObject *parent = 0);
+ virtual ~DiveEventItem();
void setEvent(struct event *ev);
struct event *getEvent();
void eventVisibilityChanged(const QString &eventName, bool visible);