Skip to content

Commit

Permalink
Only ever display one crash handler dialog at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielsherry committed May 14, 2024
1 parent bfdf238 commit 55df980
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions SwingUI/src/main/java/org/peakaboo/ui/swing/app/CrashHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class CrashHandler {

private static CrashHandler handler;

public static void init() {
if (handler != null) return; //subsequent calls do nothing
handler = new CrashHandler();
Expand All @@ -34,6 +34,9 @@ public static CrashHandler get() {

private Bugsnag bugsnag;

/* Only allow one crash report dialog at a time to prevent spamming */
private boolean inUse = false;

public CrashHandler() {
var devbuild = Version.RELEASE_TYPE != Version.ReleaseType.RELEASE;
boolean autosubmit=DesktopSettings.isCrashAutoreporting() || devbuild;
Expand Down Expand Up @@ -76,11 +79,14 @@ public void handle(String message, Throwable throwable) {
});
};


ErrorDialog errorDialog = new ErrorDialog(null, "Peakaboo Error", message, throwable, doReport);

errorDialog.setModal(true);
errorDialog.setVisible(true); //stalls here until dialog closes
if (!inUse) {
inUse = true;
ErrorDialog errorDialog = new ErrorDialog(null, "Peakaboo Error", message, throwable, doReport);
errorDialog.setModal(true);
errorDialog.setVisible(true); //stalls here until dialog closes
inUse = false;
}


if (! reported.get() && DesktopSettings.isCrashAutoreporting()) {
//When autoreporting is on, we report even when the user doesn't send additional feedback
Expand Down

0 comments on commit 55df980

Please sign in to comment.