summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org
diff options
context:
space:
mode:
authorGrant Gayed <grant_gayed@ca.ibm.com>2011-12-22 12:30:32 -0500
committerGrant Gayed <grant_gayed@ca.ibm.com>2011-12-22 12:30:32 -0500
commit1585ebb14115790898593946bf9938c97f5e76f5 (patch)
tree0dee44e6aadef5a0ef691cebb851340353dbcf2a /bundles/org.eclipse.swt/Eclipse SWT/gtk/org
parentafd2596f7d0b684f40a6cde49ffd8b1e1885b748 (diff)
downloadeclipse.platform.swt-1585ebb14115790898593946bf9938c97f5e76f5.tar.gz
eclipse.platform.swt-1585ebb14115790898593946bf9938c97f5e76f5.tar.xz
eclipse.platform.swt-1585ebb14115790898593946bf9938c97f5e76f5.zip
Bug 367414 - Table#getSelection() throws an AIOOBE
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java8
2 files changed, 7 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index 7c475acee0..5edfc18fec 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -621,15 +621,15 @@ public int getSelectionIndex () {
for (int i=0; i<count; i++) {
int /*long*/ data = OS.g_list_nth_data (list, i);
int /*long*/ indices = OS.gtk_tree_path_get_indices (data);
- OS.gtk_tree_path_free (data);
if (indices != 0) {
OS.memmove (index, indices, 4);
- for (int j = i + 1; j < count; j++) {
+ for (int j = i; j < count; j++) {
data = OS.g_list_nth_data (list, j);
OS.gtk_tree_path_free (data);
}
break;
}
+ OS.gtk_tree_path_free (data);
}
OS.g_list_free (list);
return index [0];
@@ -680,13 +680,13 @@ public int [] getSelectionIndices () {
for (int i=0; i<count; i++) {
int /*long*/ data = OS.g_list_nth_data (list, i);
int /*long*/ indices = OS.gtk_tree_path_get_indices (data);
- OS.gtk_tree_path_free (data);
if (indices != 0) {
int [] index = new int [1];
OS.memmove (index, indices, 4);
treeSelection [length] = index [0];
length++;
}
+ OS.gtk_tree_path_free (data);
}
OS.g_list_free (list);
int [] result = new int [length];
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 a6ee89d464..6ce0782fe0 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
@@ -1671,13 +1671,13 @@ public TableItem [] getSelection () {
for (int i=0; i<count; i++) {
int /*long*/ data = OS.g_list_nth_data (list, i);
int /*long*/ indices = OS.gtk_tree_path_get_indices (data);
- OS.gtk_tree_path_free (data);
if (indices != 0) {
int [] index = new int [1];
OS.memmove (index, indices, 4);
treeSelection [length] = index [0];
length++;
}
+ OS.gtk_tree_path_free (data);
}
OS.g_list_free (list);
TableItem [] result = new TableItem [length];
@@ -1744,15 +1744,15 @@ public int getSelectionIndex () {
for (int i=0; i<count; i++) {
int /*long*/ data = OS.g_list_nth_data (list, i);
int /*long*/ indices = OS.gtk_tree_path_get_indices (data);
- OS.gtk_tree_path_free (data);
if (indices != 0) {
OS.memmove (index, indices, 4);
- for (int j = i + 1; j < count; j++) {
+ for (int j = i; j < count; j++) {
data = OS.g_list_nth_data (list, j);
OS.gtk_tree_path_free (data);
}
break;
}
+ OS.gtk_tree_path_free (data);
}
OS.g_list_free (list);
return index [0];
@@ -1802,13 +1802,13 @@ public int [] getSelectionIndices () {
for (int i=0; i<count; i++) {
int /*long*/ data = OS.g_list_nth_data (list, i);
int /*long*/ indices = OS.gtk_tree_path_get_indices (data);
- OS.gtk_tree_path_free (data);
if (indices != 0) {
int [] index = new int [1];
OS.memmove (index, indices, 4);
treeSelection [length] = index [0];
length++;
}
+ OS.gtk_tree_path_free (data);
}
OS.g_list_free (list);
int [] result = new int [length];