mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: reverse plotting and showing of profile
When switching from "empty mode" (i.e. the subsurface logo is shown, because no dive is selected), the profile is first shown by switching to the appropriate tab and then plotted. However, the showing might lead to a resize event and then to a crash with owing to stale dive data. Therefore, reverse that. Note that I never could reproduce that. Reported-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
9bca38afcf
commit
e0e21cab3d
1 changed files with 3 additions and 4 deletions
|
@ -155,7 +155,6 @@ void ProfileWidget::setEnabledToolbar(bool enabled)
|
|||
|
||||
void ProfileWidget::setDive(const struct dive *d)
|
||||
{
|
||||
// If the user was currently editing a dive, exit edit mode.
|
||||
stack->setCurrentIndex(1); // show profile
|
||||
|
||||
bool freeDiveMode = d->dc.divemode == FREEDIVE;
|
||||
|
@ -198,13 +197,13 @@ void ProfileWidget::plotCurrentDive()
|
|||
|
||||
setEnabledToolbar(current_dive != nullptr);
|
||||
if (editedDive) {
|
||||
setDive(originalDive);
|
||||
view->plotDive(editedDive.get(), editedDc);
|
||||
setDive(editedDive.get());
|
||||
} else if (current_dive) {
|
||||
setDive(current_dive);
|
||||
view->setProfileState(current_dive, dc_number);
|
||||
view->resetZoom(); // when switching dive, reset the zoomLevel
|
||||
view->plotDive(current_dive, dc_number);
|
||||
setDive(current_dive);
|
||||
} else {
|
||||
view->clear();
|
||||
stack->setCurrentIndex(0);
|
||||
|
@ -235,8 +234,8 @@ void ProfileWidget::divesChanged(const QVector<dive *> &dives, DiveField field)
|
|||
void ProfileWidget::setPlanState(const struct dive *d, int dc)
|
||||
{
|
||||
exitEditMode();
|
||||
setDive(d);
|
||||
view->setPlanState(d, dc);
|
||||
setDive(d);
|
||||
}
|
||||
|
||||
void ProfileWidget::unsetProfHR()
|
||||
|
|
Loading…
Add table
Reference in a new issue