Changeset 14177 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2018-08-22T02:41:48+02:00 (6 years ago)
Author:
Don-vip
Message:

see #16666 - add workaround against ATK wrapper failure on Debian, Ubuntu and Mint

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r14176 r14177  
    66import static org.openstreetmap.josm.tools.Utils.getSystemProperty;
    77
     8import java.awt.AWTError;
    89import java.awt.Container;
    910import java.awt.Dimension;
     
    874875                args.getSingle(Option.GEOMETRY).orElse(null),
    875876                !args.hasOption(Option.NO_MAXIMIZE) && Config.getPref().getBoolean("gui.maximized", false));
    876         final MainFrame mainFrame = new MainFrame(geometry);
     877        final MainFrame mainFrame = createMainFrame(geometry);
    877878        final Container contentPane = mainFrame.getContentPane();
    878879        if (contentPane instanceof JComponent) {
     
    10161017            Logging.info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console");
    10171018            RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
     1019        }
     1020    }
     1021
     1022    private static MainFrame createMainFrame(WindowGeometry geometry) {
     1023        try {
     1024            return new MainFrame(geometry);
     1025        } catch (AWTError e) {
     1026            // #12022 #16666 On Debian, Ubuntu and Linux Mint the first AWT toolkit access can fail because of ATK wrapper
     1027            // Good news: the error happens after the toolkit initialization so we can just try again and it will work
     1028            Logging.error(e);
     1029            return new MainFrame(geometry);
    10181030        }
    10191031    }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r14148 r14177  
    4949    @Override
    5050    public void preStartupHook() {
    51         // See #12022 - Disable GNOME ATK Java wrapper as it causes a lot of serious trouble
    52         if ("org.GNOME.Accessibility.AtkWrapper".equals(getSystemProperty("assistive_technologies"))) {
    53             System.clearProperty("assistive_technologies");
     51        // See #12022, #16666 - Disable GNOME ATK Java wrapper as it causes a lot of serious trouble
     52        if (isDebianOrUbuntu()) {
     53            if (Utils.getJavaVersion() >= 9) {
     54                // TODO: find a way to disable ATK wrapper on Java >= 9
     55                // We should probably be able to do that by embedding a no-op AccessibilityProvider in our jar
     56                // so that it is loaded by ServiceLoader without error
     57                // But this require to compile at least one class with Java 9
     58            } else {
     59                // Java 8 does a simple Class.newInstance() from system classloader
     60                Utils.updateSystemProperty("javax.accessibility.assistive_technologies", "java.lang.Object");
     61            }
    5462        }
    5563    }
Note: See TracChangeset for help on using the changeset viewer.