Some fix to avoid deadlocks when using MFC.