Fix tray icon crash when clicked quickly on start
SwingUtil adds a click event to focus the frame, but the frame isn't fully built when the icon is created. Click after the icon was made and before the frame was built caused a crash. Moved icon creation to after the frame is built, should resolve the problem.
This commit is contained in:
@@ -301,8 +301,6 @@ public class ClientUI
|
|||||||
// Try to enable fullscreen on OSX
|
// Try to enable fullscreen on OSX
|
||||||
OSXUtil.tryEnableFullscreen(frame);
|
OSXUtil.tryEnableFullscreen(frame);
|
||||||
|
|
||||||
trayIcon = SwingUtil.createTrayIcon(ICON, properties.getTitle(), frame);
|
|
||||||
|
|
||||||
frame.setTitle(properties.getTitle());
|
frame.setTitle(properties.getTitle());
|
||||||
frame.setIconImage(ICON);
|
frame.setIconImage(ICON);
|
||||||
frame.getLayeredPane().setCursor(Cursor.getDefaultCursor()); // Prevent substance from using a resize cursor for pointing
|
frame.getLayeredPane().setCursor(Cursor.getDefaultCursor()); // Prevent substance from using a resize cursor for pointing
|
||||||
@@ -399,6 +397,8 @@ public class ClientUI
|
|||||||
frame.toFront();
|
frame.toFront();
|
||||||
requestFocus();
|
requestFocus();
|
||||||
giveClientFocus();
|
giveClientFocus();
|
||||||
|
|
||||||
|
trayIcon = SwingUtil.createTrayIcon(ICON, properties.getTitle(), frame);
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.post(new ClientUILoaded());
|
eventBus.post(new ClientUILoaded());
|
||||||
|
|||||||
Reference in New Issue
Block a user