diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-07-05 12:36:40 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-07-05 12:46:07 +0200 |
commit | 9e036ed903406f11d875bf73b459222b6b051a28 (patch) | |
tree | 8488b8bad151a1c237b6a4266d4527b8c2d1828c /tracker-easy/tracker-easy.cpp | |
parent | 63b7fc37dc2df96ccda2b3854fe18ab57b4296b3 (diff) |
tracker/easy: avoid race & crash on exit
cv::destroyWindow() can't be called along with `cv::imshow()' in
progress from another thread. Moreover, `cv::waitKey()' doesn't work
without any windows present.
Also check for preview enablement to avoid a crash in
`cv::destroyWindow()'.
Diffstat (limited to 'tracker-easy/tracker-easy.cpp')
-rw-r--r-- | tracker-easy/tracker-easy.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp index 211eb267..fbc19dea 100644 --- a/tracker-easy/tracker-easy.cpp +++ b/tracker-easy/tracker-easy.cpp @@ -88,10 +88,11 @@ namespace EasyTracker Tracker::~Tracker() { - cv::destroyWindow("Preview"); - iThread.exit(); iThread.wait(); + + if (iDebug) + cv::destroyWindow("Preview"); if (camera) { |