Skip to content

Commit 82e12fc

Browse files
author
Jonathan Feinberg
committed
Attempt to call registered dispose handlers on uncaught exceptions.
Fixes jdf/Processing.py-Bugs#97
1 parent f44c94c commit 82e12fc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

runtime/src/jycessing/PAppletJythonDriver.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,11 @@ public void start() {
547547
@Override
548548
public void uncaughtException(final Thread t, final Throwable e) {
549549
terminalException = toSketchException(e);
550+
try {
551+
handleMethods("dispose");
552+
} catch (final Exception noop) {
553+
// give up
554+
}
550555
finishedLatch.countDown();
551556
}
552557
});
@@ -631,13 +636,10 @@ public void componentMoved(final ComponentEvent e) {
631636
static private void macosxFullScreenToggle(final Window window) {
632637
try {
633638
final Class<?> appClass = Class.forName("com.apple.eawt.Application");
634-
635639
final Method getAppMethod = appClass.getMethod("getApplication");
636-
final Object app = getAppMethod.invoke(null, new Object[0]);
637-
640+
final Object app = getAppMethod.invoke(null);
638641
final Method requestMethod = appClass.getMethod("requestToggleFullScreen", Window.class);
639642
requestMethod.invoke(app, window);
640-
641643
} catch (final ClassNotFoundException cnfe) {
642644
// ignored
643645
} catch (final Exception e) {

0 commit comments

Comments
 (0)