Make it possible to prevent garbage collection of CodeBehind class #430
In some situations a JavaFX controller class (CodeBehind) can be garbage collected which can be unexpected. This is especially true for the MVVM pattern were the focus is on binding ui controls to properties of the ViewModel. Because normal databinding uses weak references internally this can lead to wrong behaviour of the application because the code behind and the viewModel are garbage collected.
The purpose of this issue is:
Our viewloader could keep references to codebehind instances so that they aren't available for garbage collection anymore. However, this would lead to memory leaks because there are many situations were a codeBehind should be garbage collected (for example when an extra window is closed all resources of this window should be collected).
This means that we can't prefent garbage collection for all codeBehinds. Instead we could provide an extra mechanism to the developer to explicitly declare that a codeBehind shouldn't be garbage collected.
One way of doing this could be an interface
This interface could have a method
The text was updated successfully, but these errors were encountered: