[glib/glib-2-28] Don't assert on backend == settings->priv->backend



commit ddfddbcb40045383af1e156db98538d8dd445874
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Apr 7 21:25:01 2011 -0400

    Don't assert on backend == settings->priv->backend
    
    They could be different if a notification is queued for delivery and
    someone calls g_settings_delay().
    
    Bug #646843.

 gio/gsettings.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/gio/gsettings.c b/gio/gsettings.c
index 9c8f32b..ac05c6c 100644
--- a/gio/gsettings.c
+++ b/gio/gsettings.c
@@ -311,7 +311,17 @@ settings_backend_changed (GObject             *target,
   gboolean ignore_this;
   gint i;
 
-  g_assert (settings->priv->backend == backend);
+  /* We used to assert here:
+   *
+   *   settings->priv->backend == backend
+   *
+   * but it could be the case that a notification is queued for delivery
+   * while someone calls g_settings_delay() (which changes the backend).
+   *
+   * Since the delay backend would just pass that straight through
+   * anyway, it doesn't make sense to try to detect this case.
+   * Therefore, we just accept it.
+   */
 
   for (i = 0; key[i] == settings->priv->path[i]; i++);
 
@@ -335,8 +345,6 @@ settings_backend_path_changed (GObject          *target,
   GSettings *settings = G_SETTINGS (target);
   gboolean ignore_this;
 
-  g_assert (settings->priv->backend == backend);
-
   if (g_str_has_prefix (settings->priv->path, path))
     g_signal_emit (settings, g_settings_signals[SIGNAL_CHANGE_EVENT],
                    0, NULL, 0, &ignore_this);
@@ -353,8 +361,6 @@ settings_backend_keys_changed (GObject             *target,
   gboolean ignore_this;
   gint i;
 
-  g_assert (settings->priv->backend == backend);
-
   for (i = 0; settings->priv->path[i] &&
               settings->priv->path[i] == path[i]; i++);
 
@@ -395,8 +401,6 @@ settings_backend_writable_changed (GObject          *target,
   gboolean ignore_this;
   gint i;
 
-  g_assert (settings->priv->backend == backend);
-
   for (i = 0; key[i] == settings->priv->path[i]; i++);
 
   if (settings->priv->path[i] == '\0' &&
@@ -413,8 +417,6 @@ settings_backend_path_writable_changed (GObject          *target,
   GSettings *settings = G_SETTINGS (target);
   gboolean ignore_this;
 
-  g_assert (settings->priv->backend == backend);
-
   if (g_str_has_prefix (settings->priv->path, path))
     g_signal_emit (settings, g_settings_signals[SIGNAL_WRITABLE_CHANGE_EVENT],
                    0, (GQuark) 0, &ignore_this);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]