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

WizardPageSupport does not dispose DataBindingContext #2358

Open
basilevs opened this issue Oct 3, 2024 · 0 comments
Open

WizardPageSupport does not dispose DataBindingContext #2358

basilevs opened this issue Oct 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@basilevs
Copy link
Contributor

basilevs commented Oct 3, 2024

Following test fails in org.eclipse.core.databinding 1.13.300
Paste it into WizardPageSupportTest.java to reproduce.

public class org.eclipse.jface.tests.databinding.wizard.WizardPageSupportTest extends AbstractSWTTestCase {
	@Test
	public void testDispose() {
		AtomicBoolean disposedAtomic = new AtomicBoolean(false);
		IWizardPage page = new WizardPage("Page") {
			@Override
			public void createControl(Composite parent) {
				setControl(parent);
				DataBindingContext dbc = new DataBindingContext();
				dbc.addValidationStatusProvider(new ValidationStatusProvider() {

					@Override
					public IObservableValue<IStatus> getValidationStatus() {
						return new ConstantObservableValue(dbc.getValidationRealm(), Status.OK_STATUS, IStatus.class);
					}

					@Override
					public IObservableList<IObservable> getTargets() {
						return Observables.emptyObservableList(dbc.getValidationRealm());
					}

					@Override
					public IObservableList<IObservable> getModels() {
						return Observables.emptyObservableList(dbc.getValidationRealm());
					}

					@Override
					public void dispose() {
						disposedAtomic.set(true);
						super.dispose();
					}
				});
				WizardPageSupport.create(this, dbc); // Should dispose all status providers when wizard is closed
			}
		};
		loadWizardPage(page);
		assertTrue(disposedAtomic.get());
	}

}

WizardPageSupport.create() documentation does not mention that DBC is not disposed and no snippets from examples dispose the DBC explicitly.

@basilevs basilevs added the bug Something isn't working label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant