When I was trying to call VNCviewer from another application and wait for it's termination, I have found, that there is really big delay (more than 2sec) after manually closing window, when application is still running on the background.
I have found where it's hanging for most of the time and it's here:
ClientConnection::run_undetached - line 4607
Sleep(2000);
What is the reason for this sleep? Is it used just for autoreconnect as some big enough delay or why? Could it be possibly replaced with something like this:
if (m_autoReconnect > 0) Sleep(2000);