ItEr58S18CUEscaladoPantallaCargaRecursosEmpresaItEr57S10: Solved a bug that deleted the name filter listener while it was still in use.

The garbage collector deleted it because there were no strong references, but it could be still in use.
This commit is contained in:
Jacobo Aragunde Pérez 2010-05-20 20:37:23 +02:00 committed by Javier Moran Rua
parent df27ede355
commit bac99b74da

View file

@ -193,15 +193,23 @@ public class ResourceLoadController implements Composer {
addNameFilterListener();
}
private void addNameFilterListener() {
resourcesLoadPanel.addNameFilterListener(new IPaginationFilterChangedListener() {
/*
* This object is stored in an attribute to keep one reference to it, so the
* garbage collector doesn't get rid of it. It's necessary because it is stored
* by ResourcesLoadPanel using weak references.
*/
private IPaginationFilterChangedListener keepAlivePaginationListener =
new IPaginationFilterChangedListener() {
@Override
public void filterChanged(int initialPosition) {
resourceLoadModel.setPageFilterPosition(initialPosition);
reload(currentFilterByResources);
addSchedulingScreenListeners();
}
});
};
private void addNameFilterListener() {
resourcesLoadPanel.addNameFilterListener(keepAlivePaginationListener);
}
private void addSchedulingScreenListeners() {