Win32: correct the 'one-instance' deallocation code
'one-instance' happens to work on Win32 though there are several issues:
- a WM_QUIT is sent to the helper thread when any instance terminates
(the master or a secondary instance). 'one-instance' should then stop
working as soon as the first secondary instance terminates.
- But, sending WM_QUIT via SendMessage directly calls the window
procedure callback. And this callback here doesn't process the message
at all. Therefore, it is a no-op and the thread is actually never stopped.
This patch does the following :
- move the WM_QUIT message to ensure that only the master (first) instance
stops the helper thread.
- process the WM_QUIT message in the window procedure callback, and call
for clean termination of the thread.
Note that PostQuitMessage cannot be directly called as there are two
distincts threads here.