Called to dispose of resources and shut down the sketch. Destroys the thread, dispose the renderer,and notify listeners. Not to be called or overridden by users. If called multiple times, will only notify listeners once. Register a "dispose" listener instead.
()
| 3406 | * will only notify listeners once. Register a "dispose" listener instead. |
| 3407 | */ |
| 3408 | public void dispose() { |
| 3409 | // moved here from stop() |
| 3410 | finished = true; // let the sketch know it is shut down time |
| 3411 | |
| 3412 | // don't run the disposers twice |
| 3413 | if (surface.stopThread()) { |
| 3414 | |
| 3415 | // shut down renderer |
| 3416 | if (g != null) { |
| 3417 | g.dispose(); |
| 3418 | } |
| 3419 | // run dispose() methods registered by libraries |
| 3420 | handleMethods("dispose"); |
| 3421 | } |
| 3422 | |
| 3423 | if (platform == MACOS) { |
| 3424 | try { |
| 3425 | final String td = "processing.core.ThinkDifferent"; |
| 3426 | final Class<?> thinkDifferent = getClass().getClassLoader().loadClass(td); |
| 3427 | thinkDifferent.getMethod("cleanup").invoke(null); |
| 3428 | } catch (Exception e) { |
| 3429 | e.printStackTrace(); |
| 3430 | } |
| 3431 | } |
| 3432 | |
| 3433 | } |
| 3434 | |
| 3435 | |
| 3436 |
no test coverage detected