improve thread safety in GDelayedSettingsBackend

- hold a lock while accessing the tree of delayed values
  - use weak reference counts with the owner object to avoid doing
    g_object_notify on a dead object
  - dispatch the "has-unapplied" notify to the proper main context
This commit is contained in:
Ryan Lortie
2010-05-16 16:56:36 -04:00
parent 61219e2640
commit 799e0242ae
5 changed files with 121 additions and 24 deletions

View File

@@ -126,7 +126,7 @@ is_path (const gchar *path)
return TRUE;
}
static GMainContext *
GMainContext *
g_settings_backend_get_active_context (void)
{
GMainContext *context;
@@ -177,7 +177,7 @@ struct _GSettingsBackendClosure
static void
g_settings_backend_watch_weak_notify (gpointer data,
GObject *where_object_was)
GObject *where_the_object_was)
{
GSettingsBackend *backend = data;
GSettingsBackendWatch **ptr;
@@ -185,7 +185,7 @@ g_settings_backend_watch_weak_notify (gpointer data,
/* search and remove */
g_static_mutex_lock (&backend->priv->lock);
for (ptr = &backend->priv->watches; *ptr; ptr = &(*ptr)->next)
if ((*ptr)->target == where_object_was)
if ((*ptr)->target == where_the_object_was)
{
GSettingsBackendWatch *tmp = *ptr;