Skip to content

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

Description

@Rizen59

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);
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions