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

Unconfigure a form while the model change can produce random exceptions #199

Open
Rizen59 opened this issue Dec 8, 2021 · 0 comments
Open
Labels

Comments

@Rizen59
Copy link
Contributor

Rizen59 commented Dec 8, 2021

Unconfigure a form while the model change can produce random exceptions.

It can be explained by multiple reasons :

  • the form is still "attached" to model listeners during the unconfiguration process start
  • changing the model from any thread can trigger change in view, but some elements are currently unconfigured

Here is a unit test that show to problem :

public class Issue199Test {

    @Rule
    public JavaFXRule javaFXRule = new JavaFXRule();

    @Rule
    public FailOnUncaughtExceptionRule failOnUncaughtExceptionRule = new FailOnUncaughtExceptionRule();

    public class Bean {
        private StringProperty value = new SimpleStringProperty();
        public String getValue() { return value.get(); }
        public StringProperty valueProperty() { return value; }
        public void setValue(String value) { this.value.set(value); }
    }

    @Test
    public void testToUnconfigureFormDuringAModelChange() throws InterruptedException {
        Bean bean = new Bean();
        FXForm form = new FXForm();
        form.setSource(bean);

        Thread thread = new Thread(() -> {
            while (true) {
                bean.setValue(UUID.randomUUID().toString());
            }
        });
        thread.start();
        Thread.sleep(3000); // Wait a little to be sure thread is start

        form.setSource(null);
    }
}
@Rizen59 Rizen59 added the bug label Dec 8, 2021
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