diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-02-17 04:40:53 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-02-17 04:41:10 +0100 |
commit | 38306b389951c69d050e3e4b929b442b5bd0ada5 (patch) | |
tree | 5f282d68ca80bae8e64000ceb7315ff12c6efa1c /tracker-pt/point_extractor.h | |
parent | 925c0811d6b24069eb9f527c2c02301cc1ba5ca4 (diff) |
tracker/pt: protect get_n_points()
There's a race here since further accesses to the points array aren't
protected by a mutex in the extractor class.
There's no race in "get_points()" in the extractor since it's only used
in same thread where updates take place.
Diffstat (limited to 'tracker-pt/point_extractor.h')
-rw-r--r-- | tracker-pt/point_extractor.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tracker-pt/point_extractor.h b/tracker-pt/point_extractor.h index 030251ff..8bcc2437 100644 --- a/tracker-pt/point_extractor.h +++ b/tracker-pt/point_extractor.h @@ -23,6 +23,7 @@ public: // WARNING: returned reference is valid as long as object const std::vector<cv::Vec2f> &extract_points(cv::Mat &frame); const std::vector<cv::Vec2f>& get_points() { QMutexLocker l(&mtx); return points; } + int get_n_points() const { QMutexLocker l(&mtx); return points.size(); } PointExtractor(); settings_pt s; |