Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2019-02-08 14:07:47 +0000
committerAndrey Loskutov2019-02-08 14:07:47 +0000
commitc90f23c0191a0615d00083530791a8d7738581a3 (patch)
tree01723c86e632dd666a34edc4117aced34cf35c85 /bundles
parent0321466122a608f94cb72c68be73972cb59e66d2 (diff)
downloadeclipse.platform.swt-c90f23c0191a0615d00083530791a8d7738581a3.tar.gz
eclipse.platform.swt-c90f23c0191a0615d00083530791a8d7738581a3.tar.xz
eclipse.platform.swt-c90f23c0191a0615d00083530791a8d7738581a3.zip
Bug 544282 - [GTK3] org.eclipse.swt.widgets.Table.remove(int, int) is
extremely slow In case we set table items count to zero, it is way faster to use GTK.gtk_list_store_clear() instead of iterating over every element via GTK.gtk_list_store_remove(). Change-Id: I0ae296b40b05fcdfcecc1d2d8a3fb4885d9c9b64 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index bcdd1fbf55..20015d028d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -3610,7 +3610,11 @@ public void setItemCount (int count) {
if (count == itemCount) return;
boolean isVirtual = (style & SWT.VIRTUAL) != 0;
if (!isVirtual) setRedraw (false);
- remove (count, itemCount - 1);
+ if(count == 0) {
+ removeAll();
+ } else {
+ remove (count, itemCount - 1);
+ }
int length = Math.max (4, (count + 3) / 4 * 4);
TableItem [] newItems = new TableItem [length];
System.arraycopy (items, 0, newItems, 0, itemCount);

Back to the top