mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Don't cross link events between displayed_dive and current_dive
The copy_dive assumed that the event being removed was from current_dive, wich was until a very recent past. now it can't assume that anymore, so instead of setting ev = assumed_dive->event->next, we do a ev = current_dive->event->next. Fixes #663 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1786148d31
commit
8c8657f996
1 changed files with 7 additions and 2 deletions
9
dive.c
9
dive.c
|
@ -70,8 +70,13 @@ void remove_event(struct event* event)
|
|||
while (ep && !same_event(*ep, event))
|
||||
ep = &(*ep)->next;
|
||||
if (ep) {
|
||||
*ep = event->next;
|
||||
free(event);
|
||||
/* we can't link directly with event->next
|
||||
* because 'event' can be a copy from another
|
||||
* dive (for instance the displayed_dive
|
||||
* that we use on the interface to show things). */
|
||||
struct event *temp = (*ep)->next;
|
||||
free(*ep);
|
||||
*ep = temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue