aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget/diveeventitem.h
diff options
context:
space:
mode:
authorGravatar K. \"pestophagous\" Heller <pestophagous@gmail.com>2015-12-03 21:42:23 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-03 22:56:23 -0800
commit2778470b9755af2349a70f127e208750afda7725 (patch)
tree334f68c2aa1802c21634799b0d85f20b0222f304 /profile-widget/diveeventitem.h
parentb0063e5d1a6004e4459a872ae166065e52e460d6 (diff)
downloadsubsurface-2778470b9755af2349a70f127e208750afda7725.tar.gz
Prevent gaschange tank icons from using garbage coords.
Tank icons were shown at incorrect spots on the profile when the DiveEventItem object held a pointer to a struct event even after the struct event at that address had been freed. When internalEvent is a pointer to freed memory, internalEvent->time.seconds could have all kinds of crazy values, which get used in member function DiveEventItem::recalculatePos to place the tank at bad x coordinates. The DiveEventItem(s) no longer store a pointer to memory that they do not own. This way, no matter how the path of execution arrives into slot recalculatePos, we never need fear that the DiveEventItem will dereference a garbage pointer to a struct event. Fixes #968 Signed-off-by: K. Heller <pestophagous@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget/diveeventitem.h')
-rw-r--r--profile-widget/diveeventitem.h1
1 files changed, 1 insertions, 0 deletions
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);