losing the validation listener

Tom Eugelink tbee at tbee.org
Sun Apr 7 12:28:37 PDT 2013

Again some strange behavior I could use some pointers with. In JFXtras I've created an extended ToggleGroup which has a value property.

Basically what it does is listen to the selectedToggleProperty of ToggleGroup, and upon invalidation gets the user data associated with the now active toggle and puts that in the valueProperty. Simple, and now you can register and listen to the value of the toggle group. Which is exactly what I do in my basketball application by registering to the invalidated event.
     toggleGroup.valueProperty().addListener(new InvalidationListener() {...});

Now I have one very strange behavior; if I disable or hide the toggles, and then re-enable/show them again, the invalidation listener is no longer called. Some how it seems to have been removed from the listeners list. But the API documentation explicitly says it is a strong reference.

If I add a second dummy listener, then the first listener is not removed when disabled/hidden.

It very much reeks like a garbage collection thing. Any suggestions?


More information about the openjfx-dev mailing list