CaptureCoop / SnipSniper

The Screenshot Tool
https://SnipSniper.net
MIT License
3 stars 0 forks source link

Update the way we handle closable sub-windows #150

Open SvenWollinger opened 1 year ago

SvenWollinger commented 1 year ago

Scenario 1:

  1. You open the Config Window
  2. You open a color chooser in it, it gets added to a list to close should the parent window close
  3. You close the chooser

Now the chooser is still in the list of closables, eg being kept alive by jvm.

This is potentially huge. But removing the sub window when its closing from the list can cause a concurrent modification exception, since it also gets triggered when the parent window closes, eg when we are looping over the list the sub window is now trying to remove itself from.

We should unify the listeners used for this and possibly write a manager for it, that handles these cases properly.