With the two patches now pushed as 1bbc20accd98, then building an x64 msi, installing it on Windows 7 SP1 x64 and then terminating the overlay server from the taskbar cmenu, I see in
[02/24/11 00:40:03] TortoiseHg Overlay Icon Server, Version 1.9.3+133-4e8ae5ff6ad0
[02/24/11 00:40:03] Logging to file started
[02/24/11 00:40:54] Stopping pipe server...
[02/24/11 00:40:54] PipeServer thread terminating
[02/24/11 00:40:54] Updater thread terminating
[02/24/11 00:40:54] Traceback (most recent call last):
File "TortoiseHgOverlayServer.py", line 198, in stop_pipe_server
File "tortoisehg\util\thread2.pyo", line 52, in terminate
File "tortoisehg\util\thread2.pyo", line 47, in raise_exc
File "tortoisehg\util\thread2.pyo", line 19, in _async_raise
ValueError: invalid thread id
[02/24/11 00:40:54] Goodbye
I thought you had attached patches for the overlay server, but that was for the ctypes issue. I didn't expect to have to pull changes because I had just pushed a couple minutes earlier without any warnings. No big deal.
I agree the traceback is most likely harmless, just a timing quirk.
How about this theory: DestroyWindow() is ignored because of access privileges and the process just stays open.