summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio_quarti@ca.ibm.com>2012-01-25 10:15:07 -0500
committerSilenio Quarti <silenio_quarti@ca.ibm.com>2012-01-25 10:16:00 -0500
commit5dc68b1cb799fd3d7f3b8218db3d623442a9221c (patch)
tree0d2913640bbd286c37db11626ae9f9322cc8a871
parent2b55541da7a18b7f348931c2fb61f81eb1d459db (diff)
downloadeclipse.platform.swt-5dc68b1cb799fd3d7f3b8218db3d623442a9221c.tar.gz
eclipse.platform.swt-5dc68b1cb799fd3d7f3b8218db3d623442a9221c.tar.xz
eclipse.platform.swt-5dc68b1cb799fd3d7f3b8218db3d623442a9221c.zip
Bug 356414 - TreeItem.setExpanded(false) can cause blank lines in a
virtual tree.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java21
3 files changed, 13 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 7cc3998e67..222d6e603e 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
@@ -206,7 +206,7 @@ int /*long*/ cellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*lo
if (isPixbuf) {
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_PIXBUF, ptr, -1);
OS.g_object_set (cell, OS.pixbuf, ptr [0], 0);
- OS.g_object_unref (ptr [0]);
+ if (ptr [0] != 0) OS.g_object_unref (ptr [0]);
} else {
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_TEXT, ptr, -1);
if (ptr [0] != 0) {
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 30ef7ba698..67210ef839 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
@@ -251,7 +251,7 @@ int /*long*/ cellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*lo
ptr [0] = 0;
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_PIXBUF, ptr, -1);
OS.g_object_set (cell, OS.pixbuf, ptr[0], 0);
- OS.g_object_unref (ptr [0]);
+ if (ptr [0] != 0) OS.g_object_unref (ptr [0]);
} else {
ptr [0] = 0;
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_TEXT, ptr, -1);
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 68d8a81a5f..da70cac94e 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
@@ -1315,18 +1315,19 @@ public void setChecked (boolean checked) {
public void setExpanded (boolean expanded) {
checkWidget();
int /*long*/ path = OS.gtk_tree_model_get_path (parent.modelHandle, handle);
- if (expanded) {
- OS.g_signal_handlers_block_matched (parent.handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, TEST_EXPAND_ROW);
- OS.gtk_tree_view_expand_row (parent.handle, path, false);
- OS.g_signal_handlers_unblock_matched (parent.handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, TEST_EXPAND_ROW);
- } else {
- OS.g_signal_handlers_block_matched (parent.handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, TEST_COLLAPSE_ROW);
- OS.gtk_widget_realize (parent.handle);
- OS.gtk_tree_view_collapse_row (parent.handle, path);
- OS.g_signal_handlers_unblock_matched (parent.handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, TEST_COLLAPSE_ROW);
+ if (expanded != OS.gtk_tree_view_row_expanded (parent.handle, path)) {
+ if (expanded) {
+ OS.g_signal_handlers_block_matched (parent.handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, TEST_EXPAND_ROW);
+ OS.gtk_tree_view_expand_row (parent.handle, path, false);
+ OS.g_signal_handlers_unblock_matched (parent.handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, TEST_EXPAND_ROW);
+ } else {
+ OS.g_signal_handlers_block_matched (parent.handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, TEST_COLLAPSE_ROW);
+ OS.gtk_widget_realize (parent.handle);
+ OS.gtk_tree_view_collapse_row (parent.handle, path);
+ OS.g_signal_handlers_unblock_matched (parent.handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, TEST_COLLAPSE_ROW);
+ }
}
OS.gtk_tree_path_free (path);
- cached = true;
}