Cleanup: call calculate_max_limits_new() in create_plot_info_new()

All callers of create_plot_info_new() called calculate_max_limits_new()
a line before. Thus, simply call the latter in the former.

This allows us to automatically free the plot data in create_plot_info_new().
The old code overwrote the corresponding field with NULL.

As a side-effect, this removes a bogus static variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-07-06 15:34:31 +02:00 committed by Dirk Hohndel
parent 69be1e23f2
commit ae60fdf815
4 changed files with 12 additions and 17 deletions

View file

@ -636,8 +636,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
* shown.
*/
free_plot_info_data(&plotInfo);
plotInfo = calculate_max_limits_new(&displayed_dive, currentdc);
// create_plot_info_new() automatically frees old plot data
#ifndef SUBSURFACE_MOBILE
create_plot_info_new(&displayed_dive, currentdc, &plotInfo, !shouldCalculateMaxDepth, &DivePlannerPointsModel::instance()->final_deco_state);
#else