From 6c95dd01845a9d2939e92b824781efd075ef8fcb Mon Sep 17 00:00:00 2001 From: mguessan Date: Tue, 17 May 2011 21:41:20 +0000 Subject: [PATCH] SWT: register error handler early git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1688 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/ui/tray/SwtGatewayTray.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/java/davmail/ui/tray/SwtGatewayTray.java b/src/java/davmail/ui/tray/SwtGatewayTray.java index f685ae97..14e281c0 100644 --- a/src/java/davmail/ui/tray/SwtGatewayTray.java +++ b/src/java/davmail/ui/tray/SwtGatewayTray.java @@ -171,10 +171,16 @@ public class SwtGatewayTray implements DavGatewayTrayInterface { * Create tray icon and register frame listeners. */ public void init() { + // register error handler to avoid application crash on concurrent X access from SWT and AWT + try { + OS.gdk_error_trap_push(); + } catch (NoClassDefFoundError e) { + // ignore + } final String systemLookAndFeelClassName = UIManager.getSystemLookAndFeelClassName(); try { // workaround for bug when SWT and AWT both try to access Gtk - if (systemLookAndFeelClassName.indexOf("gtk") >=0) { + if (systemLookAndFeelClassName.indexOf("gtk") >= 0) { System.setProperty("swing.defaultlaf", UIManager.getCrossPlatformLookAndFeelClassName()); } else { System.setProperty("swing.defaultlaf", systemLookAndFeelClassName); @@ -308,11 +314,6 @@ public class SwtGatewayTray implements DavGatewayTrayInterface { } }); - // register error handler to avoid application crash on concurrent X access from SWT and AWT - if (systemLookAndFeelClassName.indexOf("gtk") >=0) { - OS.gdk_error_trap_push(); - } - // display settings frame on first start if (Settings.isFirstStart()) { // create frame on first call