Remove a surplus GDK_THREADS_LEAVE() and avoid a potential use after free

2007-07-04  Chris Wilson  <chris@chris-wilson.co.uk>

    * gtk/gtkrecentchoosermenu.c (idle_populate_func),
    (idle_populate_clean_up), (gtk_recent_chooser_menu_populate):
    Remove a surplus GDK_THREADS_LEAVE() and avoid a potential use after
    free in the source destroy notify. (#453033)


svn path=/trunk/; revision=18375
This commit is contained in:
Chris Wilson 2007-07-04 07:41:57 +00:00 committed by Chris Wilson
parent 631806a20f
commit 93a1d3d298
2 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2007-07-04 Chris Wilson <chris@chris-wilson.co.uk>
* gtk/gtkrecentchoosermenu.c (idle_populate_func),
(idle_populate_clean_up), (gtk_recent_chooser_menu_populate):
Remove a surplus GDK_THREADS_LEAVE() and avoid a potential use after
free in the source destroy notify. (#453033)
2007-07-04 Johan Dahlin <jdahlin@async.com.br>
* gtk/gtkcelllayout.c (_gtk_cell_layout_buildable_add_child):

View File

@ -921,6 +921,7 @@ typedef struct
gint loaded_items;
gint displayed_items;
GtkRecentChooserMenu *menu;
GtkWidget *placeholder;
} MenuPopulateData;
static gboolean
@ -943,11 +944,9 @@ idle_populate_func (gpointer data)
if (!pdata->items)
{
/* show the placeholder here */
gtk_widget_show (priv->placeholder);
gtk_widget_show (pdata->placeholder);
pdata->displayed_items = 1;
GDK_THREADS_LEAVE ();
return FALSE;
}
@ -1001,13 +1000,13 @@ static void
idle_populate_clean_up (gpointer data)
{
MenuPopulateData *pdata = data;
GtkRecentChooserMenuPrivate *priv = pdata->menu->priv;
/* show the placeholder in case no item survived
* the filtering process in the idle loop
*/
if (!pdata->displayed_items)
gtk_widget_show (priv->placeholder);
gtk_widget_show (pdata->placeholder);
g_object_unref (pdata->placeholder);
g_slice_free (MenuPopulateData, data);
}
@ -1027,6 +1026,7 @@ gtk_recent_chooser_menu_populate (GtkRecentChooserMenu *menu)
pdata->loaded_items = 0;
pdata->displayed_items = 0;
pdata->menu = menu;
pdata->placeholder = g_object_ref (priv->placeholder);
priv->icon_size = get_icon_size_for_widget (GTK_WIDGET (menu));