mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
desktop: avoid crash when changing dive logs
If the last displayed dive had events, those DiveEventItems had slots connected that would update those icons if things changed. When closing the dive log and switching to a different one, those slots were still called and would then access freed memory (the event structure from that old dive that is long gone by then). This code explicitly deletes those DiveEventItems which also removes those signal slot connections. Fixes #3305 Sugested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
75fdb8676b
commit
f7e222718a
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
|||
- avoid potential crash when switching divelogs
|
||||
- add GPS fix downloaded from a dive comuter to existing dive site
|
||||
- fix broken curser left/right shortcut for showing multiple dive computers
|
||||
- allow editing the profile for dives imported without samples (via CSV)
|
||||
|
|
|
@ -1078,7 +1078,11 @@ void ProfileWidget2::setEmptyState()
|
|||
hideAll(allPercentages);
|
||||
hideAll(handles);
|
||||
#endif
|
||||
hideAll(eventItems);
|
||||
// the events will have connected slots which can fire after
|
||||
// the dive and its data have been deleted - so explictly delete
|
||||
// the DiveEventItems
|
||||
qDeleteAll(eventItems);
|
||||
eventItems.clear();
|
||||
hideAll(gases);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue