diff dwt/widgets/Tree.d @ 211:00180515eb65

Update to SWT 3.3.2
author Frank Benoit <benoit@tionex.de>
date Wed, 19 Mar 2008 21:36:28 +0100
parents 08789b28bdf3
children 8e159d7052e0
line wrap: on
line diff
--- a/dwt/widgets/Tree.d	Wed Mar 19 20:14:48 2008 +0100
+++ b/dwt/widgets/Tree.d	Wed Mar 19 21:36:28 2008 +0100
@@ -2310,6 +2310,21 @@
     */
     auto selection = OS.gtk_tree_view_get_selection (handle);
     OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED);
+    /*
+    * Bug in GTK.  In version 2.8, when gtk_tree_view_set_model() is called, GTK
+    * does not remove the timer used to show animation when expanding a node. This
+    * can cause two possible crashes. The first one happens when the timer expires and
+    * it accesses the expanding node which has been already destroyed. The second one
+    * happens if a new item is created and destroyed before the timer expires. The fix
+    * is to remove the timer by disposing the first item in the tree.
+    */
+    if (OS.GTK_VERSION < OS.buildVERSION(2, 10, 0)) {
+        if (OS.gtk_tree_model_iter_n_children (modelHandle, null) !is 0) {
+            GtkTreeIter iter;
+            OS.gtk_tree_model_iter_nth_child (modelHandle, &iter, null, 0);
+            OS.gtk_tree_store_remove (modelHandle, &iter);
+        }
+    }
     // TODO verify if true for tree store
     //OS.gtk_tree_store_clear (modelHandle);
     auto oldModel = modelHandle;