aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget/profilewidget2.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-06-05 09:29:41 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-06-05 11:29:00 -0700
commit0b190243dd4463f3c944037b8688372f9cce1c5d (patch)
treebaffc5e0aebfc7947b70ecbf2599ea0917aaafee /profile-widget/profilewidget2.cpp
parentfd2862042b1aa925bd842f512ee6260865e2f5b1 (diff)
downloadsubsurface-0b190243dd4463f3c944037b8688372f9cce1c5d.tar.gz
profile: remove internal event-copy (fix deleting/renaming events)
The DiveEventItem had an internal copy of the event. It passed that copy to the undo-machinery, which of course didn't work. Simply keep a pointer to the event. All changes to a dive no pass via the undo-machinery, which causes a reload of the profile, so this should be safe. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/profilewidget2.cpp')
-rw-r--r--profile-widget/profilewidget2.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 3503df75f..19ee319b0 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1419,7 +1419,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) {
m.addAction(tr("Remove event"), [this,item] { removeEvent(item); });
m.addAction(tr("Hide similar events"), [this, item] { hideEvents(item); });
- struct event *dcEvent = item->getEvent();
+ const struct event *dcEvent = item->getEvent();
if (dcEvent->type == SAMPLE_EVENT_BOOKMARK)
m.addAction(tr("Edit name"), [this, item] { editName(item); });
#if 0 // TODO::: FINISH OR DISABLE
@@ -1496,7 +1496,7 @@ void ProfileWidget2::makeFirstDC()
void ProfileWidget2::hideEvents(DiveEventItem *item)
{
- struct event *event = item->getEvent();
+ const struct event *event = item->getEvent();
if (QMessageBox::question(this,
TITLE_OR_TEXT(tr("Hide events"), tr("Hide all %1 events?").arg(event->name)),
@@ -1529,7 +1529,7 @@ void ProfileWidget2::unhideEvents()
void ProfileWidget2::removeEvent(DiveEventItem *item)
{
- struct event *event = item->getEvent();
+ struct event *event = item->getEventMutable();
if (!event || !d)
return;
@@ -1617,7 +1617,7 @@ double ProfileWidget2::getFontPrintScale() const
#ifndef SUBSURFACE_MOBILE
void ProfileWidget2::editName(DiveEventItem *item)
{
- struct event *event = item->getEvent();
+ struct event *event = item->getEventMutable();
if (!event || !d)
return;
bool ok;