From db69c38245cc260d19e189716e73dbbbedd56273 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 18 Jan 2021 22:29:34 +0100 Subject: statistics: refactor QSG memory management The code was wrong, because it deleted the ChartItems in the main UI thread, not the render thread. This would delete the QSG nodes in the UI thread and then crash on mobile. Therefore refactor this part of the code by adding the items to be deleted to a list that will be deleted by the render thread. As a drop in replacement of std::unique_ptr, implement a silly ChartItemPtr class, which auto-initializes to null. This turns the deterministic and easily controlled memory management into a steaming pile of insanity. Obviously, this can be made much more elegant, but this has to do for now. Signed-off-by: Berthold Stoeger --- stats/scatterseries.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'stats/scatterseries.cpp') diff --git a/stats/scatterseries.cpp b/stats/scatterseries.cpp index e522ce81f..791bb81ca 100644 --- a/stats/scatterseries.cpp +++ b/stats/scatterseries.cpp @@ -116,7 +116,7 @@ bool ScatterSeries::hover(QPointF pos) highlighted = std::move(newHighlighted); if (highlighted.empty()) { - information.reset(); + information->setVisible(false); return false; } else { if (!information) @@ -148,6 +148,7 @@ bool ScatterSeries::hover(QPointF pos) } information->setText(text, pos); + information->setVisible(true); return true; } } -- cgit v1.2.3-70-g09d2