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/module.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/module.cpp')
-rw-r--r-- | tracker-pt/module.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tracker-pt/module.cpp b/tracker-pt/module.cpp index d977aa16..c73b771e 100644 --- a/tracker-pt/module.cpp +++ b/tracker-pt/module.cpp @@ -16,14 +16,14 @@ using namespace pt_module; struct pt_module_traits final : pt_runtime_traits { - std::unique_ptr<pt_camera> make_camera() const override + pointer<pt_camera> make_camera() const override { - return std::unique_ptr<pt_camera>(new Camera(module_name)); + return pointer<pt_camera>(new Camera(module_name)); } - std::unique_ptr<pt_point_extractor> make_point_extractor() const override + pointer<pt_point_extractor> make_point_extractor() const override { - return std::unique_ptr<pt_point_extractor>(new PointExtractor(module_name)); + return pointer<pt_point_extractor>(new PointExtractor(module_name)); } QString get_module_name() const override @@ -31,14 +31,14 @@ struct pt_module_traits final : pt_runtime_traits return module_name; } - std::unique_ptr<pt_frame> make_frame() const override + pointer<pt_frame> make_frame() const override { - return std::unique_ptr<pt_frame>(new Frame); + return pointer<pt_frame>(new Frame); } - std::unique_ptr<pt_preview> make_preview(int w, int h) const override + pointer<pt_preview> make_preview(int w, int h) const override { - return std::unique_ptr<pt_preview>(new Preview(w, h)); + return pointer<pt_preview>(new Preview(w, h)); } }; @@ -51,7 +51,7 @@ struct tracker_pt : Tracker_PT struct dialog_pt : TrackerDialog_PT { - dialog_pt() : TrackerDialog_PT(module_name) {} + dialog_pt(); }; class metadata_pt : public Metadata @@ -64,4 +64,8 @@ class metadata_pt : public Metadata using namespace pt_module; + + +dialog_pt::dialog_pt() : TrackerDialog_PT(module_name) {} + OPENTRACK_DECLARE_TRACKER(tracker_pt, dialog_pt, metadata_pt) |