pystray icon indicating copy to clipboard operation
pystray copied to clipboard

update_menu is not thread-safe on macOS/win32

Open simonlindholm opened this issue 4 years ago • 0 comments

update_menu is meant to be called from the setup thread, but is currently unsafe to use on macOS/win32, since the main thread may be updating the menu at the same time. In addition, Cocoa requires that UI functions be called from the main thread.

Both implementations of _update_menu need to be changed to pass a message to the main thread, and do the real menu updates there.

macOS has similar problems with update_icon and update_title, and the win32 update_icon implementation should be reviewed as well (update_icon looks safe).

#59 fixed this for the GTK backend.

simonlindholm avatar Jul 03 '20 14:07 simonlindholm