aboutsummaryrefslogtreecommitdiffstats
path: root/core/profile.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-09 18:11:56 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-10 15:57:39 -0800
commit54e8fe5d9e588c3345ded27982edaf72654fc8d1 (patch)
tree14460c74f1a9bf9cdd228a933fac509bf39043a2 /core/profile.c
parent193513a61fc7fcfb31c1cb969f7fe05452abd67c (diff)
downloadsubsurface-54e8fe5d9e588c3345ded27982edaf72654fc8d1.tar.gz
profile: pass dive to ToolTipItem::refresh()
Don't access the global displayed_dive variable in a step to make the profile reentrant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/profile.c')
-rw-r--r--core/profile.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/profile.c b/core/profile.c
index 3ddd2300b..2cd34f2a0 100644
--- a/core/profile.c
+++ b/core/profile.c
@@ -1414,7 +1414,7 @@ struct divecomputer *select_dc(struct dive *dive)
return get_dive_dc(dive, i);
}
-static void plot_string(const struct plot_info *pi, int idx, struct membuffer *b)
+static void plot_string(const struct dive *d, const struct plot_info *pi, int idx, struct membuffer *b)
{
int pressurevalue, mod, ead, end, eadd;
const char *depth_unit, *pressure_unit, *temp_unit, *vertical_speed_unit;
@@ -1429,7 +1429,7 @@ static void plot_string(const struct plot_info *pi, int idx, struct membuffer *b
int mbar = get_plot_pressure(pi, idx, cyl);
if (!mbar)
continue;
- struct gasmix mix = get_cylinder(&displayed_dive, cyl)->gasmix;
+ struct gasmix mix = get_cylinder(d, cyl)->gasmix;
pressurevalue = get_pressure_units(mbar, &pressure_unit);
put_format_loc(b, translate("gettextFromC", "P: %d%s (%s)\n"), pressurevalue, pressure_unit, gasname(mix));
}
@@ -1569,7 +1569,7 @@ static void plot_string(const struct plot_info *pi, int idx, struct membuffer *b
strip_mb(b);
}
-int get_plot_details_new(const struct plot_info *pi, int time, struct membuffer *mb)
+int get_plot_details_new(const struct dive *d, const struct plot_info *pi, int time, struct membuffer *mb)
{
int i;
@@ -1580,7 +1580,7 @@ int get_plot_details_new(const struct plot_info *pi, int time, struct membuffer
if (pi->entry[i].sec >= time)
break;
}
- plot_string(pi, i, mb);
+ plot_string(d, pi, i, mb);
return i;
}