forked from AuroraMiddleware/gtk
Ensure we always grab the gdk lock in async callbacks
Async callbacks are delivered in idles, so we need to make sure we get the gdk lock before calling any gdk/gtk stuff. This was missing in a few places.
This commit is contained in:
parent
7dec704421
commit
c9c23b0728
@ -6648,11 +6648,16 @@ file_system_model_got_thumbnail (GObject *object, GAsyncResult *res, gpointer da
|
||||
if (queried == NULL)
|
||||
return;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
/* now we know model is valid */
|
||||
|
||||
/* file was deleted */
|
||||
if (!_gtk_file_system_model_get_iter_for_file (model, &iter, file))
|
||||
return;
|
||||
{
|
||||
GDK_THREADS_LEAVE ();
|
||||
return;
|
||||
}
|
||||
|
||||
info = g_file_info_dup (_gtk_file_system_model_get_info (model, &iter));
|
||||
|
||||
@ -6663,6 +6668,8 @@ file_system_model_got_thumbnail (GObject *object, GAsyncResult *res, gpointer da
|
||||
_gtk_file_system_model_update_file (model, file, info, FALSE);
|
||||
|
||||
g_object_unref (info);
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1345,6 +1345,8 @@ query_created_file_info_callback (GObject *source_object,
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
folder = GTK_FOLDER (user_data);
|
||||
gtk_folder_add_file (folder, file, info);
|
||||
|
||||
@ -1353,6 +1355,7 @@ query_created_file_info_callback (GObject *source_object,
|
||||
g_slist_free (files);
|
||||
|
||||
g_object_unref (info);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1150,7 +1150,9 @@ gtk_file_system_model_query_done (GObject * object,
|
||||
if (info == NULL)
|
||||
return;
|
||||
|
||||
gdk_threads_enter ();
|
||||
_gtk_file_system_model_update_file (model, file, info, TRUE);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1175,7 +1177,9 @@ gtk_file_system_model_monitor_change (GFileMonitor * monitor,
|
||||
model);
|
||||
break;
|
||||
case G_FILE_MONITOR_EVENT_DELETED:
|
||||
gdk_threads_enter ();
|
||||
remove_file (model, file);
|
||||
gdk_threads_leave ();
|
||||
break;
|
||||
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
||||
/* FIXME: use freeze/thaw with this somehow? */
|
||||
|
@ -457,7 +457,9 @@ gtk_recent_manager_monitor_changed (GFileMonitor *monitor,
|
||||
{
|
||||
case G_FILE_MONITOR_EVENT_CHANGED:
|
||||
case G_FILE_MONITOR_EVENT_CREATED:
|
||||
gdk_threads_enter ();
|
||||
gtk_recent_manager_changed (manager);
|
||||
gdk_threads_leave ();
|
||||
break;
|
||||
|
||||
case G_FILE_MONITOR_EVENT_DELETED:
|
||||
@ -931,6 +933,8 @@ gtk_recent_manager_add_item_query_info (GObject *source_object,
|
||||
recent_data.groups = NULL;
|
||||
recent_data.is_private = FALSE;
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
/* Ignore return value, this can't fail anyway since all required
|
||||
* fields are set */
|
||||
gtk_recent_manager_add_full (manager, uri, &recent_data);
|
||||
@ -938,6 +942,8 @@ gtk_recent_manager_add_item_query_info (GObject *source_object,
|
||||
manager->priv->is_dirty = TRUE;
|
||||
gtk_recent_manager_changed (manager);
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_free (recent_data.mime_type);
|
||||
g_free (recent_data.app_name);
|
||||
g_free (recent_data.app_exec);
|
||||
|
@ -226,6 +226,8 @@ search_callback (gpointer results,
|
||||
gchar *uri;
|
||||
gint i;
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
tracker = GTK_SEARCH_ENGINE_TRACKER (user_data);
|
||||
hit_uris = NULL;
|
||||
|
||||
@ -235,11 +237,15 @@ search_callback (gpointer results,
|
||||
{
|
||||
_gtk_search_engine_error (GTK_SEARCH_ENGINE (tracker), error->message);
|
||||
g_error_free (error);
|
||||
gdk_threads_leave ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!results)
|
||||
return;
|
||||
{
|
||||
gdk_threads_leave ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (tracker->priv->version == TRACKER_0_8 ||
|
||||
tracker->priv->version == TRACKER_0_9)
|
||||
@ -276,6 +282,8 @@ search_callback (gpointer results,
|
||||
|
||||
g_list_foreach (hit_uris, (GFunc) g_free, NULL);
|
||||
g_list_free (hit_uris);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user