Calling exit() using FX2D renderer doesn't stop program

Hi,

I’ve noticed that when I call exit(); in a program using the FX2D renderer, an error appears in the console: Not on FX application thread; currentThread = JavaFX Application Thread. This error usually appears when the program is not correctly shut down.

The Java app also stays open, while the sketch window is closed, and the only way it seems to be able to close the thread is to within the IDE stop it.

Is there a way to get around this, so it’s possible to exit the program, and can anyone else replicate this error?

Here’s what creates the error for me:

void setup() {
  size(100,100,FX2D);
  exit();
}

Thanks!

Hi,

Does the same happen with

void setup() {
  size(100, 100, FX2D);
}
void draw() {
}
void keyPressed() {
  exit();
}

? I can’t test because FX2D doesn’t work at all for me.

Yes, calling exit(); anywhere causes the error.

using processing IDE 3.4

  • win 7 32bit
    works fine
  • raspberry pi Raspbian
    can not start:
java.lang.RuntimeException: You need to use "Import Library" to add processing.javafx.PGraphicsFX2D to your sketch.
	at processing.core.PApplet.makeGraphics(PApplet.java:2280)
	at processing.core.PApplet.createPrimaryGraphics(PApplet.java:2317)
	at processing.core.PApplet.initSurface(PApplet.java:10872)
	at processing.core.PApplet.runSketch(PApplet.java:10811)
	at processing.core.PApplet.main(PApplet.java:10511)

no idea what import i need?
testing also P2D P3D on raspberry
show me a black background window,
the “key” exit works,
but i get following red console info:

EGLDisplayUtil.EGLDisplays: Shutdown (open: 1)
EGLDisplayUtil: Open EGL Display Connections: 1
EGLDisplayUtil: Open[0]: 0x1: EGLDisplayRef[0x1: refCnt 2]

and for openprocessing


ERROR
FX2D is not defined

1 Like

You don’t need any libraries for the error to appear. Is an error thrown if you run this code?

void setup() {
  size(100,100,FX2D);
  exit();
}

Is an error thrown if you run this code?

NOT on windows 7 / processing IDE 3.4
YES on Raspberry ( see above )

possibly you tell us your working environment?

I’m using a MacBook air on High Sierra.

Can any other Mac users see the error?

1 Like

With

void setup() {
  size(100,100,FX2D);
  exit();
}

…I see the error

Not on FX application thread; currentThread = JavaFX Application Thread

on macOS Sierra 10.12.6, MacBook Pro 13" 2016.

@Sarah, have you considered reporting this to Issues · processing/processing · GitHub

Thanks for testing it out! I was waiting to report it because it seemed like no other users got it, but it seems that it’s a Mac related error.

I’ve opened an issue now:

1 Like