| Summary: | [DataBinding] Binding.disposeListener should check if binding is already disposed | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Tonny Madsen <tonny.madsen> |
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert |
| Version: | 3.6.1 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
Example missing: - create observable a. - create observable z. - add dispose listener, L, to a that will dispose of z. - add binding between a and z. This is also add a dispose listener to both a and z: baL and bzL When a is disposed, you'll get: - dispose listeners of a found: L plus baL. - L is called, which disposes z. - dispose listeners of z found:; bzL - bzL called, which disposes b (including setting context to null). -baL called, but now context is null!!!! Any change for a fix for this in 3.7? This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
When using multiple dispose listener for the same observable, a later listener in the list can occasionally be called after the observable has been disposed completely. In this case the disposeListener of Binding can be called with context == null resulting in an NPE. To solve this change the code of Binding.init() to public final void init(DataBindingContext context) { this.context = context; if (target.isDisposed()) throw new IllegalArgumentException("Target observable is disposed"); //$NON-NLS-1$ if (model.isDisposed()) throw new IllegalArgumentException("Model observable is disposed"); //$NON-NLS-1$ this.disposeListener = new IDisposeListener() { public void handleDispose(DisposeEvent staleEvent) { if (isDisposed()) return; Binding.this.context.getValidationRealm().exec(new Runnable() { public void run() { if (!isDisposed()) dispose(); } }); } }; target.addDisposeListener(disposeListener); model.addDisposeListener(disposeListener); preInit(); context.addBinding(this); postInit(); } -- Configuration Details -- Product: Eclipse 1.3.1.20100913-1228 (org.eclipse.epp.package.rcp.product) Installed Features: org.eclipse.platform 3.6.1.r361_v20100909-9gF78GrkFqw7GrsZnvz0JWNTeb6fue6896L