mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
treelistmodel: Delay notifies from TreeListRow
Don't notify during destruction, notify afterwards. This way we don't call into user code from a half-destructed node. Note that this changes the order in which those notifies happen when collapsing a large tree: From parent node before child nodes to child nodes before parent node. No actual use case for this, just thought it would be safer.
This commit is contained in:
parent
8766a6fab2
commit
3c76f3fb58
@ -415,10 +415,16 @@ gtk_tree_list_model_clear_node (gpointer data)
|
||||
TreeNode *node = data;
|
||||
|
||||
if (node->row)
|
||||
gtk_tree_list_row_destroy (node->row);
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (node->row));
|
||||
gtk_tree_list_row_destroy (node->row);
|
||||
}
|
||||
|
||||
gtk_tree_list_model_clear_node_children (node);
|
||||
|
||||
if (node->row)
|
||||
g_object_thaw_notify (G_OBJECT (node->row));
|
||||
|
||||
g_clear_object (&node->item);
|
||||
}
|
||||
|
||||
@ -955,16 +961,12 @@ G_DEFINE_TYPE (GtkTreeListRow, gtk_tree_list_row, G_TYPE_OBJECT)
|
||||
static void
|
||||
gtk_tree_list_row_destroy (GtkTreeListRow *self)
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
|
||||
self->node = NULL;
|
||||
|
||||
/* FIXME: We could check some properties to avoid excess notifies */
|
||||
g_object_notify_by_pspec (G_OBJECT (self), row_properties[ROW_PROP_DEPTH]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), row_properties[ROW_PROP_EXPANDABLE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), row_properties[ROW_PROP_EXPANDED]);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user