Browse Source

avoiding possible infinite loop if lot of cache row requests in variable burst queue

svn changeset:4592/svn branch:trunk
tags/6.7.0.beta1
Matti Tahvonen 16 years ago
parent
commit
9191d6b62d
1 changed files with 12 additions and 6 deletions
  1. 12
    6
      src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java

+ 12
- 6
src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java View File

@@ -331,16 +331,18 @@ public class IScrollTable extends Composite implements Table, ScrollListener,

final int optimalFirstRow = (int) (firstRowInViewPort - pageLength
* CACHE_RATE);
while (tBody.getLastRendered() > optimalFirstRow
boolean cont = true;
while (cont && tBody.getLastRendered() > optimalFirstRow
&& tBody.getFirstRendered() < optimalFirstRow) {
// client.console.log("removing row from start");
tBody.unlinkRow(true);
cont = tBody.unlinkRow(true);
}
final int optimalLastRow = (int) (firstRowInViewPort + pageLength + pageLength
* CACHE_RATE);
while (tBody.getLastRendered() > optimalLastRow) {
cont = true;
while (cont && tBody.getLastRendered() > optimalLastRow) {
// client.console.log("removing row from the end");
tBody.unlinkRow(false);
cont = tBody.unlinkRow(false);
}
tBody.fixSpacers();

@@ -1769,9 +1771,12 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
return renderedRows.iterator();
}

public void unlinkRow(boolean fromBeginning) {
/**
* @return false if couldn't remove row
*/
public boolean unlinkRow(boolean fromBeginning) {
if (lastRendered - firstRendered < 0) {
return;
return false;
}
int index;
if (fromBeginning) {
@@ -1788,6 +1793,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
orphan(toBeRemoved);
renderedRows.remove(index);
fixSpacers();
return true;
}

public boolean remove(Widget w) {

Loading…
Cancel
Save