From ae60fdf815d1febe36b5f43642a28afbaf84362b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 6 Jul 2019 15:34:31 +0200 Subject: 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 --- profile-widget/profilewidget2.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'profile-widget/profilewidget2.cpp') diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index f377eeb8e..ca6ce3950 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -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 -- cgit v1.2.3-70-g09d2