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().
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?
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.