During shutdown
::CloseHandle(exitevent);
is called twice, which results in this exception:
Exception thrown at 0x00007FFDF4F92D6A (ntdll.dll) in SmartFTP.exe: 0xC0000008: An invalid handle was specified.
It happens when asio::detail::win_iocp_io_context::shutdown() is called multiple times.
The problem seems to be that the timer_thread is not reset here:
During shutdown ::CloseHandle(exitevent); is called twice, which results in this exception: Exception thrown at 0x00007FFDF4F92D6A (ntdll.dll) in SmartFTP.exe: 0xC0000008: An invalid handle was specified.
It happens when asio::detail::win_iocp_io_context::shutdown() is called multiple times. The problem seems to be that the timer_thread is not reset here: