Subject: [PATCH] #23437: Detect immediate exits after loading plugins
---
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/MainApplication.java b/src/org/openstreetmap/josm/gui/MainApplication.java
|
a
|
b
|
|
| 54 | 54 | import javax.swing.Action; |
| 55 | 55 | import javax.swing.InputMap; |
| 56 | 56 | import javax.swing.JComponent; |
| | 57 | import javax.swing.JDialog; |
| 57 | 58 | import javax.swing.JLabel; |
| 58 | 59 | import javax.swing.JOptionPane; |
| 59 | 60 | import javax.swing.JPanel; |
| … |
… |
|
| 183 | 184 | * Command-line arguments used to run the application. |
| 184 | 185 | */ |
| 185 | 186 | private static volatile List<String> commandLineArgs; |
| | 187 | /** |
| | 188 | * The preference key for the startup failure counter |
| | 189 | */ |
| | 190 | private static final String PREF_STARTUP_FAILURE_COUNTER = "josm.startup.failure.count"; |
| 186 | 191 | |
| 187 | 192 | /** |
| 188 | 193 | * The main menu bar at top of screen. |
| … |
… |
|
| 873 | 878 | |
| 874 | 879 | checkIPv6(); |
| 875 | 880 | |
| | 881 | // After IPv6 check since that may restart JOSM, must be after Preferences.main().init() |
| | 882 | final int failures = prefs.getInt(PREF_STARTUP_FAILURE_COUNTER, 0); |
| | 883 | // Always increment failures |
| | 884 | prefs.putInt(PREF_STARTUP_FAILURE_COUNTER, failures + 1); |
| | 885 | if (failures > 3) { |
| | 886 | final int selection = JOptionPane.showOptionDialog(new JDialog(), |
| | 887 | tr("JOSM has failed to start up {0} times. Reset JOSM?", failures), |
| | 888 | tr("Reset JOSM?"), |
| | 889 | JOptionPane.YES_NO_OPTION, |
| | 890 | JOptionPane.ERROR_MESSAGE, |
| | 891 | null, |
| | 892 | null, |
| | 893 | null); |
| | 894 | if (selection == 0) { |
| | 895 | Preferences.main().init(true); |
| | 896 | } |
| | 897 | } |
| | 898 | |
| 876 | 899 | processOffline(args); |
| 877 | 900 | |
| 878 | 901 | PlatformManager.getPlatform().afterPrefStartupHook(); |
| … |
… |
|
| 1005 | 1028 | splash.dispose(); |
| 1006 | 1029 | } |
| 1007 | 1030 | mainFrame.setVisible(true); |
| | 1031 | Config.getPref().put(PREF_STARTUP_FAILURE_COUNTER, null); |
| 1008 | 1032 | }); |
| 1009 | 1033 | |
| 1010 | 1034 | boolean maximized = Config.getPref().getBoolean("gui.maximized", false); |