# G4P java Concurrent Modification Exception Error when exit() called

**URL:** <https://discourse.processing.org/t/g4p-java-concurrent-modification-exception-error-when-exit-called/44532>\
**Category:** Libraries\
**Created:** [June 4, 2024, 1:17am UTC](https://discourse.processing.org/t/g4p-java-concurrent-modification-exception-error-when-exit-called/44532 "2024-06-04T01:17:13Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![Thundercat](https://avatars.discourse-cdn.com/v4/letter/t/dbc845/32.png) [@Thundercat](https://discourse.processing.org/u/Thundercat)\
**Post date:** [July 10, 2024, 4:42pm UTC](https://discourse.processing.org/t/g4p-java-concurrent-modification-exception-error-when-exit-called/44532/25 "2024-07-10T16:42:43Z")

</div>

I’m trying to use the addOnCloseHandler() - but I see this only works if you use the CLOSE\_WINDOW method. If I use CLOSE\_WINDOW then when I show the window again it’s in a dead state - the controls and buttons are non-responsive, although the app doesn’t crash - so I’ve been using the HIDE\_WINDOW method which works great.

How can I use the HIDE\_WINDOW method but also capture when the user clicks the “x” to close the window instead of using the button (which hides the window)?

Sorry to be dense…I could find only one reference to “hide” in the documentation search feature…

Mike

---

_[View the full topic](https://discourse.processing.org/t/g4p-java-concurrent-modification-exception-error-when-exit-called/44532)._
