Commit 9c002e4a authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Cleanup a possible resize idle. (#311141, Robert Ögren)

2005-07-21  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkcombobox.c (gtk_combo_box_list_destroy): Cleanup
	a possible resize idle.  (#311141, Robert Ögren)

	* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed):
	(gtk_tree_model_sort_sort_level): Ref the level while using it,
	otherwise it may get nuked by gtk_tree_model_sort_increment_stamp.
	(gtk_tree_model_sort_row_deleted): Don't leak the root level
	here.  (#300089, James Bramford, Markku Vire)
parent d06ef3be
2005-07-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_list_destroy): Cleanup
a possible resize idle. (#311141, Robert Ögren)
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed):
(gtk_tree_model_sort_sort_level): Ref the level while using it,
otherwise it may get nuked by gtk_tree_model_sort_increment_stamp.
(gtk_tree_model_sort_row_deleted): Don't leak the root level
here. (#300089, James Bramford, Markku Vire)
2005-07-21 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooser.c (gtk_file_chooser_set_filename): Clarify
......@@ -92,7 +103,7 @@
* gtk/gtkwidget.c (gtk_widget_modify_bg, gtk_widget_modify_base):
Add hints on how to handle "no window" widgets. (#136347)
2005-07-20 Keith Packard <keithp@keithp.com>
* gdk/x11/gdkdrawable-x11.c: (gdk_x11_ref_cairo_surface):
......
2005-07-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_list_destroy): Cleanup
a possible resize idle. (#311141, Robert Ögren)
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed):
(gtk_tree_model_sort_sort_level): Ref the level while using it,
otherwise it may get nuked by gtk_tree_model_sort_increment_stamp.
(gtk_tree_model_sort_row_deleted): Don't leak the root level
here. (#300089, James Bramford, Markku Vire)
2005-07-21 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooser.c (gtk_file_chooser_set_filename): Clarify
......@@ -92,7 +103,7 @@
* gtk/gtkwidget.c (gtk_widget_modify_bg, gtk_widget_modify_base):
Add hints on how to handle "no window" widgets. (#136347)
2005-07-20 Keith Packard <keithp@keithp.com>
* gdk/x11/gdkdrawable-x11.c: (gdk_x11_ref_cairo_surface):
......
2005-07-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_list_destroy): Cleanup
a possible resize idle. (#311141, Robert Ögren)
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed):
(gtk_tree_model_sort_sort_level): Ref the level while using it,
otherwise it may get nuked by gtk_tree_model_sort_increment_stamp.
(gtk_tree_model_sort_row_deleted): Don't leak the root level
here. (#300089, James Bramford, Markku Vire)
2005-07-21 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooser.c (gtk_file_chooser_set_filename): Clarify
......@@ -92,7 +103,7 @@
* gtk/gtkwidget.c (gtk_widget_modify_bg, gtk_widget_modify_base):
Add hints on how to handle "no window" widgets. (#136347)
2005-07-20 Keith Packard <keithp@keithp.com>
* gdk/x11/gdkdrawable-x11.c: (gdk_x11_ref_cairo_surface):
......
......@@ -104,6 +104,7 @@ struct _GtkComboBoxPrivate
guint changed_id;
guint popup_idle_id;
guint scroll_timer;
guint resize_idle_id;
gint width;
GSList *cells;
......@@ -221,7 +222,8 @@ static void gtk_combo_box_get_property (GObject *object,
GParamSpec *spec);
static void gtk_combo_box_state_changed (GtkWidget *widget,
GtkStateType previous);static void gtk_combo_box_grab_focus (GtkWidget *widget);
GtkStateType previous);
static void gtk_combo_box_grab_focus (GtkWidget *widget);
static void gtk_combo_box_style_set (GtkWidget *widget,
GtkStyle *previous);
static void gtk_combo_box_button_toggled (GtkWidget *widget,
......@@ -2867,6 +2869,8 @@ list_popup_resize_idle (gpointer user_data)
gtk_window_move (GTK_WINDOW (combo_box->priv->popup_window), x, y);
}
combo_box->priv->resize_idle_id = 0;
GDK_THREADS_LEAVE ();
return FALSE;
......@@ -2875,7 +2879,9 @@ list_popup_resize_idle (gpointer user_data)
static void
gtk_combo_box_list_popup_resize (GtkComboBox *combo_box)
{
g_idle_add (list_popup_resize_idle, combo_box);
if (!combo_box->priv->resize_idle_id)
combo_box->priv->resize_idle_id =
g_idle_add (list_popup_resize_idle, combo_box);
}
static void
......@@ -3345,6 +3351,12 @@ gtk_combo_box_list_destroy (GtkComboBox *combo_box)
combo_box->priv->scroll_timer = 0;
}
if (combo_box->priv->resize_idle_id)
{
g_source_remove (combo_box->priv->resize_idle_id);
combo_box->priv->resize_idle_id = 0;
}
gtk_widget_destroy (combo_box->priv->tree_view);
combo_box->priv->tree_view = NULL;
......@@ -4951,7 +4963,9 @@ popup_idle (gpointer data)
/* we unset this if a menu item is activated */
combo_box->priv->editing_canceled = TRUE;
gtk_combo_box_popup (combo_box);
combo_box->priv->popup_idle_id = 0;
GDK_THREADS_LEAVE ();
return FALSE;
......
......@@ -494,6 +494,8 @@ gtk_tree_model_sort_row_changed (GtkTreeModel *s_model,
level = iter.user_data;
elt = iter.user_data2;
level->ref_count++;
if (level->array->len < 2 ||
(tree_model_sort->sort_column_id == GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID &&
tree_model_sort->default_sort_func == NO_SORT_FUNC))
......@@ -505,9 +507,11 @@ gtk_tree_model_sort_row_changed (GtkTreeModel *s_model,
gtk_tree_path_free (path);
level->ref_count--;
return;
}
if (!GTK_TREE_MODEL_SORT_CACHE_CHILD_ITERS (tree_model_sort))
{
gtk_tree_model_get_iter (tree_model_sort->child_model,
......@@ -610,6 +614,8 @@ gtk_tree_model_sort_row_changed (GtkTreeModel *s_model,
g_free (new_order);
}
level->ref_count--;
/* emit row_changed signal (at new location) */
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
gtk_tree_model_row_changed (GTK_TREE_MODEL (data), path, &iter);
......@@ -810,12 +816,18 @@ gtk_tree_model_sort_row_deleted (GtkTreeModel *s_model,
if (level->ref_count == 0)
{
/* This will prune the level, so I can just emit the signal and not worry
* about cleaning this level up. */
/* This will prune the level, so I can just emit the signal and
* not worry about cleaning this level up.
* Careful, root level is not cleaned up in increment stamp.
*/
gtk_tree_model_sort_increment_stamp (tree_model_sort);
gtk_tree_path_free (path);
if (level == tree_model_sort->root)
tree_model_sort->root = NULL;
{
gtk_tree_model_sort_free_level (tree_model_sort,
tree_model_sort->root);
tree_model_sort->root = NULL;
}
return;
}
......@@ -1620,6 +1632,8 @@ gtk_tree_model_sort_sort_level (GtkTreeModelSort *tree_model_sort,
if (level->array->len < 1 && !((SortElt *)level->array->data)->children)
return;
level->ref_count++;
/* Set up data */
data.tree_model_sort = tree_model_sort;
if (level->parent_elt)
......@@ -1741,6 +1755,8 @@ gtk_tree_model_sort_sort_level (GtkTreeModelSort *tree_model_sort,
}
g_free (new_order);
level->ref_count--;
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment