summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2008-05-21 09:10:52 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2008-05-21 09:10:52 +0000
commit9191d6b62d637fd1f9e92f18ec0fefe44cec3b65 (patch)
treec2dfdc7a7b7d220012be95c2170c07002dba549b /src
parent21fc2a80fc2648840c9663a5c8efce9eb643e444 (diff)
downloadvaadin-framework-9191d6b62d637fd1f9e92f18ec0fefe44cec3b65.tar.gz
vaadin-framework-9191d6b62d637fd1f9e92f18ec0fefe44cec3b65.zip
avoiding possible infinite loop if lot of cache row requests in variable burst queue
svn changeset:4592/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java
index ae0266cd1f..8244f74851 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java
@@ -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) {