Fix tray icon destroy overflow exception

This commit is contained in:
shortcutme 2020-03-18 03:21:00 +01:00
parent a5971adbe6
commit ca94703fc3
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 2 additions and 1 deletions

View File

@ -566,10 +566,11 @@ class NotificationIcon(object):
# print "NotificationIcon error", err, message
message = MSG()
time.sleep(0.125)
print("Icon thread stopped, removing icon...")
print("Icon thread stopped, removing icon (hicon: %s, hwnd: %s)..." % (self._hicon, self._hwnd))
Shell_NotifyIcon(NIM_DELETE, ctypes.cast(ctypes.pointer(iconinfo), ctypes.POINTER(NOTIFYICONDATA)))
ctypes.windll.user32.DestroyWindow(self._hwnd)
ctypes.windll.user32.DestroyIcon.argtypes = [ctypes.wintypes.HICON]
ctypes.windll.user32.DestroyIcon(self._hicon)