1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-14 03:32:22 -05:00

SWT: register error handler early

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1688 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-05-17 21:41:20 +00:00
parent 91c5e51ec4
commit 6c95dd0184

View File

@ -171,10 +171,16 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
* Create tray icon and register frame listeners. * Create tray icon and register frame listeners.
*/ */
public void init() { 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(); final String systemLookAndFeelClassName = UIManager.getSystemLookAndFeelClassName();
try { try {
// workaround for bug when SWT and AWT both try to access Gtk // 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()); System.setProperty("swing.defaultlaf", UIManager.getCrossPlatformLookAndFeelClassName());
} else { } else {
System.setProperty("swing.defaultlaf", systemLookAndFeelClassName); 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 // display settings frame on first start
if (Settings.isFirstStart()) { if (Settings.isFirstStart()) {
// create frame on first call // create frame on first call