dorkbox / SystemTray

Cross-platform SystemTray support for Swing/AWT, macOS, GtkStatusIcon, and AppIndicator on Java 8+
Other
446 stars 58 forks source link

WindowsEventDispatch: Error during listener execution (Win11) #176

Closed hinca closed 1 year ago

hinca commented 2 years ago

Hey dorkbox, the tray of our application disappeared during normal system use while processing an event. The error indicates an invalid image, however I wasn't able to pinpoint it further (under normal circumstances the tray icon works just fine.) Please advise.

E: 220802 11:23:01.168 [ventDispatch_0]              d.s.SystemTray:261 > Error hiding tray. Unspecified error
E: 220802 11:23:01.204 [ventDispatch_0]  d.j.w.WindowsEventDispatch:168 > Error during listener execution. java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0
    at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source) ~[?:?]
    at java.awt.image.BufferedImage.<init>(Unknown Source) ~[?:?]
    at dorkbox.util.ImageUtil.getBufferedImage(ImageUtil.java:324) ~[Utilities-1.9.jar:2021-04-10T08:14:08.532Z]
    at dorkbox.systemTray.ui.swing._WindowsNativeTray.convertImage(_WindowsNativeTray.java:298) ~[SystemTray-4.1.jar:2021-04-10T08:06:49.252271700Z]
    at dorkbox.systemTray.ui.swing._WindowsNativeTray.show(_WindowsNativeTray.java:278) ~[SystemTray-4.1.jar:2021-04-10T08:06:49.252271700Z]
    at dorkbox.systemTray.ui.swing._WindowsNativeTray.access$700(_WindowsNativeTray.java:60) ~[SystemTray-4.1.jar:2021-04-10T08:06:49.252271700Z]
    at dorkbox.systemTray.ui.swing._WindowsNativeTray$2.run(_WindowsNativeTray.java:180) ~[SystemTray-4.1.jar:2021-04-10T08:06:49.252271700Z]
    at dorkbox.jna.windows.WindowsEventDispatch$1.callback(WindowsEventDispatch.java:166) ~[Utilities-1.9.jar:2021-04-10T08:14:08.532Z]
    at dorkbox.jna.windows.User32_64.GetMessage(Native Method) ~[Utilities-1.9.jar:2021-04-10T08:14:08.532Z]
    at dorkbox.jna.windows.WindowsEventDispatch.run(WindowsEventDispatch.java:190) ~[Utilities-1.9.jar:2021-04-10T08:14:08.532Z]
    at java.lang.Thread.run(Unknown Source) ~[?:?]
dorkbox commented 1 year ago

Interesting. I would check to see if the image file properly exists and is valid. I've added some additional checks to prevent the system tray from dissapearing.