Skip to main content



      Home
Home » Eclipse Projects » JFace » [databinding] unable to dispose observable except from DataBindingContext validation realm
[databinding] unable to dispose observable except from DataBindingContext validation realm [message #20634] Tue, 14 July 2009 16:50 Go to next message
Eclipse UserFriend
A ListBinding must be disposed in the DataBindingContext validation realm
since the dispose method calls remove on the "bindings" WritableList.
However, a ListBinding also installs a dispose listener on both the target
and model observables. Therefore, if a model observable is involved in a
binding, it cannot be disposed except from the DataBindingContext validation
realm. Is this intended? Test code below.

-Will


final Exchanger<IObservableList> mModelExchanger = new
Exchanger<IObservableList>();
final CountDownLatch mModelReadyToDispose = new CountDownLatch(1);
ExecutorService executor = Executors.newSingleThreadExecutor();
Future<?> future = executor.submit(new Runnable() {
@Override
public void run() {
try {
ThreadRealm realm = new ThreadRealm(); // ThreadRealm
from JFace tests
realm.init(Thread.currentThread());
WritableList model = new WritableList(realm,
new ArrayList<Object>(), String.class);
mModelExchanger.exchange(model);
mModelReadyToDispose.await();
model.dispose(); // throws AssertionFailedException
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
});

Display d = new Display();
Realm.runWithDefault(SWTObservables.getRealm(d), new Runnable() {
@Override
public void run() {
try {
WritableList target =
WritableList.withElementType(String.class);
DataBindingContext dbc = new DataBindingContext();
dbc.bindList(target, mModelExchanger.exchange(null));
mModelReadyToDispose.countDown();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
});

future.get(); // propagates the AssertionFailedException
executor.shutdownNow();
d.dispose();
Re: [databinding] unable to dispose observable except from DataBindingContext validation realm [message #21597 is a reply to message #20634] Tue, 14 July 2009 17:03 Go to previous messageGo to next message
Eclipse UserFriend
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=281723

Matthew

Will Horn wrote:
> A ListBinding must be disposed in the DataBindingContext validation
> realm since the dispose method calls remove on the "bindings"
> WritableList. However, a ListBinding also installs a dispose listener on
> both the target and model observables. Therefore, if a model observable
> is involved in a binding, it cannot be disposed except from the
> DataBindingContext validation realm. Is this intended? Test code below.
Re: [databinding] unable to dispose observable except from DataBindingContext validation realm [message #21642 is a reply to message #21597] Tue, 14 July 2009 17:12 Go to previous messageGo to next message
Eclipse UserFriend
"Matthew Hall" <matthall@woodcraftmill.com> wrote in message
news:h3irqu$mvp$1@build.eclipse.org...
> See https://bugs.eclipse.org/bugs/show_bug.cgi?id=281723
I reported that bug, and your provided patch (thanks!) will not address the
problem I'm talking about in this thread. If you look at my test case, I'm
not using SWT widgets at all. The issue here is that if you bind two
observables, they can only be disposed on the data binding context realm.
This means the observables have to know about the databinding that is using
them!

-Will
Re: [databinding] unable to dispose observable except from DataBindingContext validation realm [message #21685 is a reply to message #21642] Wed, 15 July 2009 11:05 Go to previous messageGo to next message
Eclipse UserFriend
Have you tested it with the patch? The fix for your particular problem
should be solved by the changes to Binding.java in that patch.

Matthew

Will Horn wrote:
> "Matthew Hall" <matthall@woodcraftmill.com> wrote in message
> news:h3irqu$mvp$1@build.eclipse.org...
>> See https://bugs.eclipse.org/bugs/show_bug.cgi?id=281723
> I reported that bug, and your provided patch (thanks!) will not address
> the problem I'm talking about in this thread. If you look at my test
> case, I'm not using SWT widgets at all. The issue here is that if you
> bind two observables, they can only be disposed on the data binding
> context realm. This means the observables have to know about the
> databinding that is using them!
>
> -Will
Re: [databinding] unable to dispose observable except from DataBindingContext validation realm [message #21730 is a reply to message #21685] Wed, 15 July 2009 12:16 Go to previous message
Eclipse UserFriend
"Matthew Hall" <matthall@woodcraftmill.com> wrote in message
news:h3kr83$7c3$1@build.eclipse.org...
> Have you tested it with the patch? The fix for your particular problem
> should be solved by the changes to Binding.java in that patch.
My apologies. I had not tested the patch and did not notice the change in
Binding.java. I tried it this morning and it indeed solves the problem.
Previous Topic:[TableViewer] How to make selection visible when Editingsupport is set?
Next Topic:TableWrapLayout: position element at the beginning of a new row?
Goto Forum:
  


Current Time: Thu Jul 17 19:55:52 EDT 2025

Powered by FUDForum. Page generated in 0.06870 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top