Commit d9c315f2e314ac41a050ec0bca944134dda84a16

Authored by Josh Klontz
1 parent b428803c

fixed possible CT8 concurrency issue

Showing 1 changed file with 6 additions and 0 deletions
openbr/plugins/ct8.cpp
... ... @@ -422,8 +422,14 @@ struct CT8Compare : public Distance,
422 422 if (!srcA.m().data || !srcB.m().data) return score;
423 423  
424 424 try {
  425 + static QMutex mutex;
  426 + QMutexLocker locker(&mutex);
  427 +
  428 + // Internally Cognitec keeps a total count of the allocated templates,
  429 + // it seems that this reference count update is not thread safe
425 430 FRsdk::FIR firA = firBuilder->build( (FRsdk::Byte *) srcA.m().data, srcA.m().cols);
426 431 FRsdk::FIR firB = firBuilder->build( (FRsdk::Byte *) srcB.m().data, srcB.m().cols);
  432 +
427 433 score = (float)facialMatchingEngine->compare(firA, firB);
428 434 } catch (std::exception &e) {
429 435 qFatal("CT8Compare Exception: %s", e.what());
... ...