diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-13 07:46:12 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-13 07:46:12 +0100 |
commit | 8451b16e88b25405d9877243b253a369fd953243 (patch) | |
tree | d3cea9c9681e82a62a060ab05553ef05d80c9c24 /tracker-pt/ftnoir_tracker_pt.cpp | |
parent | 53e8b2d41988be69deb800e1ef3cbcfc699a3076 (diff) |
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.
Diffstat (limited to 'tracker-pt/ftnoir_tracker_pt.cpp')
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index bded07d3..467334de 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -13,7 +13,6 @@ #include "pt-api.hpp" #include <cmath> -#include <utility> #include <opencv2/imgproc.hpp> @@ -27,11 +26,11 @@ using namespace types; static constexpr inline int preview_width = 320, preview_height = 240; Tracker_PT::Tracker_PT(const pt_runtime_traits& traits) : - s(traits.get_module_name()), - point_extractor(std::move(traits.make_point_extractor())), - camera(std::move(traits.make_camera())), - frame(std::move(traits.make_frame())), - preview_frame(std::move(traits.make_preview(preview_width, preview_height))) + s { traits.get_module_name() }, + point_extractor { traits.make_point_extractor() }, + camera { traits.make_camera() }, + frame { traits.make_frame() }, + preview_frame { traits.make_preview(preview_width, preview_height) } { cv::setBreakOnError(true); @@ -139,7 +138,6 @@ void Tracker_PT::set_fov(int value) module_status Tracker_PT::start_tracker(QFrame* video_frame) { //video_frame->setAttribute(Qt::WA_NativeWindow); - preview_size = video_frame->size(); video_widget = std::make_unique<cv_video_widget>(video_frame); layout = std::make_unique<QHBoxLayout>(video_frame); |