From 8451b16e88b25405d9877243b253a369fd953243 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 13 Jan 2018 07:46:12 +0100 Subject: tracker/pt: workaround unexplained leak Somehow, using unique_ptr causes a leak at destruct time. The stored pointer isn't freed. It works perfectly fine with shared_ptr. It seems I'm doing things correctly with a move constructor for unique_ptr in the Tracker_PT class, as well as the pointer initialization ctor in `module.cpp'. Who the hell knows what's happening behind the scenes. --- tracker-pt/ftnoir_tracker_pt.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'tracker-pt/ftnoir_tracker_pt.h') diff --git a/tracker-pt/ftnoir_tracker_pt.h b/tracker-pt/ftnoir_tracker_pt.h index deddeea8..c9c15bc7 100644 --- a/tracker-pt/ftnoir_tracker_pt.h +++ b/tracker-pt/ftnoir_tracker_pt.h @@ -59,20 +59,21 @@ private: QMutex camera_mtx; QMutex data_mtx; - std::unique_ptr point_extractor; - std::unique_ptr camera; + template + using pointer = typename pt_runtime_traits::pointer; + PointTracker point_tracker; pt_settings s; - std::unique_ptr video_widget; std::unique_ptr layout; - std::vector points; - std::unique_ptr frame; - std::unique_ptr preview_frame; - QSize preview_size; + pointer point_extractor; + pointer camera; + pointer video_widget; + pointer frame; + pointer preview_frame; std::atomic point_count = 0; std::atomic ever_success = false; -- cgit v1.2.3