diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-07-20 07:45:31 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-07-23 11:22:43 -0700 |
commit | 16b31985c3245d5cb3be26f3cc0aa06bc6acb139 (patch) | |
tree | 972684866d5ec71781fbf91f990bea83a654ecad /profile-widget | |
parent | f142e9a9c6ba493c09a282544da8715b3656648e (diff) | |
download | subsurface-16b31985c3245d5cb3be26f3cc0aa06bc6acb139.tar.gz |
cleanup: replace membuffer by membufferpp in C-code
Thus, the membuffer data is automatically freed when going
out of scope - one thing less to worry about.
This fixes one use-after-free bug in uploadDiveLogsDE.cpp
and one extremely questionable practice in divetooltipitem.cpp:
The membuffer was a shared instance across all instances
of the DiveToolTipItem.
Remves unnecessary #include directives in files that didn't
even use membuffer.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget')
-rw-r--r-- | profile-widget/divetooltipitem.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp index 5cc6eecad..3a0a4de58 100644 --- a/profile-widget/divetooltipitem.cpp +++ b/profile-widget/divetooltipitem.cpp @@ -221,7 +221,7 @@ void ToolTipItem::setTimeAxis(DiveCartesianAxis *axis) void ToolTipItem::refresh(const dive *d, const QPointF &pos, bool inPlanner) { - static struct membuffer mb = {}; + struct membufferpp mb; if(refreshTime.elapsed() < 40) return; @@ -232,7 +232,6 @@ void ToolTipItem::refresh(const dive *d, const QPointF &pos, bool inPlanner) lastTime = time; clear(); - mb.len = 0; int idx = get_plot_details_new(d, &pInfo, time, &mb); tissues.fill(); |