Possible GtkTree deselect bug
- From: Gilbert Ramirez <gram xiexie org>
- To: gtk-list redhat com
- Subject: Possible GtkTree deselect bug
- Date: Mon, 16 Aug 1999 13:54:39 -0500
I have found what might be a bug in the gtk_tree_clear_items() function
in gtk+-1.2.3.
In Ethereal (http://ethereal.zing.org/), we use one GtkTree. For every
packet that a user wants to view, the GtkTree is cleared via
gtk_tree_clear_items(), and then re-populated with GtkTreeItems.
The problem occurs when the user has selected a subtree or a tree item
in a subtree. When Ethereal clears this tree with gtk_tree_clear_items(),
it turns out that the subtree item is _not_ deselected. This newly-cleared
tree is re-populated with new tree items, and if the user clicks on any
of these new tree items, we get this:
Gtk-CRITICAL **: file gtkwidget.c: line 3196 (gtk_widget_set_state): assertion `widget != NULL' failed.
What happened is that the tree item was not deselected in the
gtk_tree_clear_items() call, so when a new tree item is selected, gtk+
tries to deselect the old gtktree selection. That widget no longer exists
(because it was cleared), so gtk_widget_set_state gets passed a NULL widget,
causing the CRITICAL message.
I have attached a sample program. It draws a tree with a subtree, and
has two buttons. The first button clears the tree with the
gtk_tree_clear_items() function , and then repopulates the tree. The second
button deselects all gtk_tree selections by going through the GtkTree
struct and removing items from the selection list. It then calls
gtk_tree_clear_items(), and repopulates the tree.
Compile and run the progam. Open up the subtree and select the subtree
item. Then press the first button. Select any tree item on the new tree, and
you'll get the CRITICAL message.
Then try clearing the tree with the second button and then select
any tree item on the new tree. You don't get the CRITICAL message.
Am I supposed to have to deselect all the tree items before calling
gtk_tree_clear_items()? If so, a function should be provided for this
so that I don't have to dig into the GtkTree structure.
If not, is this an oversight in the gtk_tree_clear_items() function,
or am I missing something?
thanks for any help,
--gilbert
gtktree-clearbug.tar.gz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]