Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential risk for dropped listeners in UI #106

Closed
Pyknic opened this issue Jan 18, 2016 · 2 comments
Closed

Potential risk for dropped listeners in UI #106

Pyknic opened this issue Jan 18, 2016 · 2 comments
Labels

Comments

@Pyknic
Copy link
Contributor

Pyknic commented Jan 18, 2016

Many methods in the UI takes a StringProperty or a StringBinding as a parameter. Users of those methods must make sure to store a reference to the property before passing it as a parameter. Otherwise there is a risk that the property will be garbage collected as JavaFX mostly uses weak bindings.

Example:

StringProperty foo = new SimpleStringProperty();

void setValueOfFoo(StringProperty property) {
    foo.bind(property);
}

...

setValueOfFoo(new SimpleStringProperty("bar"));

In this case, the property with the value "bar" might be garbage collected sometime in the future as the reference is dropped. The only way to notice this is that foo will no longer be updated.

@Pyknic Pyknic added the bug label Jan 28, 2016
@Pyknic Pyknic added this to the 2.3.0 Hamilton milestone Jan 28, 2016
@Pyknic
Copy link
Contributor Author

Pyknic commented Jan 28, 2016

I have fixed some places where I have encountered this but there might be more places. I will let this remain open for a while longer.

@Pyknic
Copy link
Contributor Author

Pyknic commented Mar 22, 2016

I think this has been fixed everywhere now.

@Pyknic Pyknic closed this as completed Mar 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant