Deadlock when call MultiStreamHandler::TryFinish()

My code seems to run into a deadlock when I try to destroy StreamHandlerGuard object. The deadlock happens when the destructor of StreamHandlerGuard calls the join method of std::thread in the function MultiStreamHandler::TryFinish().

Cvb::V_1_1::Async::StreamHandlerGuard* streamGuard;

streamGuard = new Cvb::Async::StreamHandlerGuard(Cvb::Async::SingleStreamHandler::Create(device->Stream()), Cvb::AutoRun::Yes);

delete streamGuard;

Do you have any advices? Many thanks in advance.

Hi @tm5,

there are some scenarios that can cause a deadlock in std:thread.join(). A common one is to call join outside the main function e.g from a static object’s destructor.
Can you provide a minimal but complete example to reproduce it?

Hi @Andreas

I found my problem… I have an ImageView which is repainted by the call-back function. Calling ReleaseRefreshShare() before destroying the guard solves the problem.

Many thanks