From d9c315f2e314ac41a050ec0bca944134dda84a16 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Mon, 22 Apr 2013 19:05:49 -0400 Subject: [PATCH] fixed possible CT8 concurrency issue --- openbr/plugins/ct8.cpp | 6 ++++++ 1 file changed, 6 insertions(+), 0 deletions(-) diff --git a/openbr/plugins/ct8.cpp b/openbr/plugins/ct8.cpp index a48fb24..98c1063 100644 --- a/openbr/plugins/ct8.cpp +++ b/openbr/plugins/ct8.cpp @@ -422,8 +422,14 @@ struct CT8Compare : public Distance, if (!srcA.m().data || !srcB.m().data) return score; try { + static QMutex mutex; + QMutexLocker locker(&mutex); + + // Internally Cognitec keeps a total count of the allocated templates, + // it seems that this reference count update is not thread safe FRsdk::FIR firA = firBuilder->build( (FRsdk::Byte *) srcA.m().data, srcA.m().cols); FRsdk::FIR firB = firBuilder->build( (FRsdk::Byte *) srcB.m().data, srcB.m().cols); + score = (float)facialMatchingEngine->compare(firA, firB); } catch (std::exception &e) { qFatal("CT8Compare Exception: %s", e.what()); -- libgit2 0.21.4