diff options
4 files changed, 30 insertions, 12 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 68a5709493..3aca800842 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 @@ -511,6 +511,7 @@ void createColumn (TableColumn column, int index) { int /*long*/ newModel = OS.gtk_list_store_newv (types.length, types); if (newModel == 0) error (SWT.ERROR_NO_HANDLES); int /*long*/ [] ptr = new int /*long*/ [1]; + int [] ptr1 = new int [1]; for (int i=0; i<itemCount; i++) { int /*long*/ newItem = OS.g_malloc (OS.GtkTreeIter_sizeof ()); if (newItem == 0) error (SWT.ERROR_NO_HANDLES); @@ -518,7 +519,12 @@ void createColumn (TableColumn column, int index) { TableItem item = items [i]; if (item != null) { int /*long*/ oldItem = item.handle; - for (int j=0; j<modelLength; j++) { + /* the first three columns contain int values, subsequent columns contain pointers */ + for (int j=0; j<3; j++) { + OS.gtk_tree_model_get (oldModel, oldItem, j, ptr1, -1); + OS.gtk_list_store_set (newModel, newItem, j, ptr1 [0], -1); + } + for (int j=3; j<modelLength; j++) { OS.gtk_tree_model_get (oldModel, oldItem, j, ptr, -1); OS.gtk_list_store_set (newModel, newItem, j, ptr [0], -1); if (types [j] == OS.G_TYPE_STRING ()) { @@ -948,6 +954,7 @@ void destroyItem (TableColumn column) { int /*long*/ newModel = OS.gtk_list_store_newv (types.length, types); if (newModel == 0) error (SWT.ERROR_NO_HANDLES); int /*long*/ [] ptr = new int /*long*/ [1]; + int [] ptr1 = new int [1]; for (int i=0; i<itemCount; i++) { int /*long*/ newItem = OS.g_malloc (OS.GtkTreeIter_sizeof ()); if (newItem == 0) error (SWT.ERROR_NO_HANDLES); @@ -955,7 +962,12 @@ void destroyItem (TableColumn column) { TableItem item = items [i]; if (item != null) { int /*long*/ oldItem = item.handle; - for (int j=0; j<FIRST_COLUMN; j++) { + /* the first three columns contain int values, subsequent columns contain pointers */ + for (int j=0; j<3; j++) { + OS.gtk_tree_model_get (oldModel, oldItem, j, ptr1, -1); + OS.gtk_list_store_set (newModel, newItem, j, ptr1 [0], -1); + } + for (int j=3; j<FIRST_COLUMN; j++) { OS.gtk_tree_model_get (oldModel, oldItem, j, ptr, -1); OS.gtk_list_store_set (newModel, newItem, j, ptr [0], -1); if (ptr [0] != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java index 1a2a5e48b9..f1fc5aaa52 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java @@ -150,7 +150,7 @@ Color _getBackground (int index) { } boolean _getChecked () { - int /*long*/ [] ptr = new int /*long*/ [1]; + int [] ptr = new int [1]; OS.gtk_tree_model_get (parent.modelHandle, handle, Table.CHECKED_COLUMN, ptr, -1); return ptr [0] != 0; } @@ -1097,7 +1097,7 @@ public void setGrayed (boolean grayed) { * GTK+'s "inconsistent" state does not match SWT's concept of grayed. * Render checked+grayed as "inconsistent", unchecked+grayed as blank. */ - int /*long*/ [] ptr = new int /*long*/ [1]; + int [] ptr = new int [1]; OS.gtk_tree_model_get (parent.modelHandle, handle, Table.CHECKED_COLUMN, ptr, -1); OS.gtk_list_store_set (parent.modelHandle, handle, Table.GRAYED_COLUMN, ptr [0] == 0 ? false : grayed, -1); cached = true; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index ac79e8b168..94a93419ff 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -550,20 +550,26 @@ void copyModel (int /*long*/ oldModel, int oldStart, int /*long*/ newModel, int if (OS.gtk_tree_model_iter_children (oldModel, iter, oldParent)) { int /*long*/ [] oldItems = new int /*long*/ [OS.gtk_tree_model_iter_n_children (oldModel, oldParent)]; int oldIndex = 0; + int /*long*/ [] ptr = new int /*long*/ [1]; + int [] ptr1 = new int [1]; do { int /*long*/ newItem = OS.g_malloc (OS.GtkTreeIter_sizeof ()); if (newItem == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_tree_store_append (newModel, newItem, newParent); - int [] index = new int [1]; - OS.gtk_tree_model_get (oldModel, iter, ID_COLUMN, index, -1); + OS.gtk_tree_model_get (oldModel, iter, ID_COLUMN, ptr1, -1); + int index = ptr1[0]; TreeItem item = null; - if (index [0] != -1) { - item = items [index [0]]; + if (index != -1) { + item = items [index]; if (item != null) { int /*long*/ oldItem = item.handle; oldItems[oldIndex++] = oldItem; - int /*long*/ [] ptr = new int /*long*/ [1]; - for (int j = 0; j < FIRST_COLUMN; j++) { + /* the first three columns contain int values, subsequent columns contain pointers */ + for (int j = 0; j < 3; j++) { + OS.gtk_tree_model_get (oldModel, oldItem, j, ptr1, -1); + OS.gtk_tree_store_set (newModel, newItem, j, ptr1 [0], -1); + } + for (int j = 3; j < FIRST_COLUMN; j++) { OS.gtk_tree_model_get (oldModel, oldItem, j, ptr, -1); OS.gtk_tree_store_set (newModel, newItem, j, ptr [0], -1); if (types [j] == OS.G_TYPE_STRING ()) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java index b42956aa90..98f73da4c0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java @@ -235,7 +235,7 @@ Color _getBackground (int index) { } boolean _getChecked () { - int /*long*/ [] ptr = new int /*long*/ [1]; + int [] ptr = new int [1]; OS.gtk_tree_model_get (parent.modelHandle, handle, Tree.CHECKED_COLUMN, ptr, -1); return ptr [0] != 0; } @@ -1532,7 +1532,7 @@ public void setGrayed (boolean grayed) { * GTK+'s "inconsistent" state does not match SWT's concept of grayed. * Render checked+grayed as "inconsistent", unchecked+grayed as blank. */ - int /*long*/ [] ptr = new int /*long*/ [1]; + int [] ptr = new int [1]; OS.gtk_tree_model_get (parent.modelHandle, handle, Tree.CHECKED_COLUMN, ptr, -1); OS.gtk_tree_store_set (parent.modelHandle, handle, Tree.GRAYED_COLUMN, ptr [0] == 0 ? false : grayed, -1); cached = true; |