[maemo-commits] [maemo-commits] r11662 - in projects/haf/trunk/gconf2: . dbus-tests debian examples gconf po

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue May 15 16:24:23 EEST 2007
Author: richard
Date: 2007-05-15 16:24:20 +0300 (Tue, 15 May 2007)
New Revision: 11662

Modified:
   projects/haf/trunk/gconf2/
   projects/haf/trunk/gconf2/ChangeLog
   projects/haf/trunk/gconf2/dbus-tests/test-stale-value-bug.c
   projects/haf/trunk/gconf2/debian/changelog
   projects/haf/trunk/gconf2/examples/
   projects/haf/trunk/gconf2/gconf/
   projects/haf/trunk/gconf2/gconf/gconf-client.c
   projects/haf/trunk/gconf2/po/
Log:
Fix NB#49550.


Property changes on: projects/haf/trunk/gconf2
___________________________________________________________________
Name: svn:ignore
   - configure
Makefile.in
config.log
depcomp
config.guess
gconf-2.0.pc
config.h
ltmain.sh
config.sub
intltool-merge
config.guess.cdbs-orig
gtk-doc.make
config.sub.cdbs-orig
INSTALL
gconf-2.m4
intltool-extract
Makefile
mkinstalldirs
intltool-extract.in
intltool-update
config.status
intltool-update.in
stamp-h1
gconf-zip
config.h.in
libtool
intltool-merge.in
missing
aclocal.m4
install-sh

   + configure
Makefile.in
config.log
depcomp
config.guess
gconf-2.0.pc
config.h
ltmain.sh
config.sub
intltool-merge
config.guess.cdbs-orig
gtk-doc.make
config.sub.cdbs-orig
INSTALL
gconf-2.m4
intltool-extract
Makefile
mkinstalldirs
intltool-extract.in
intltool-update
config.status
intltool-update.in
stamp-h1
gconf-zip
config.h.in
libtool
intltool-merge.in
missing
aclocal.m4
install-sh
autom4te.cache


Modified: projects/haf/trunk/gconf2/ChangeLog
===================================================================
--- projects/haf/trunk/gconf2/ChangeLog	2007-05-15 13:20:00 UTC (rev 11661)
+++ projects/haf/trunk/gconf2/ChangeLog	2007-05-15 13:24:20 UTC (rev 11662)
@@ -1,3 +1,11 @@
+2007-05-15  Richard Hult  <richard at imendio.com>
+
+	* dbus-tests/test-stale-value-bug.c: Improve the test.
+
+	* gconf/gconf-client.c (remove_key_from_cache_recursively_foreach)
+	(remove_key_from_cache_foreach): Fix the checks for keys to
+	remove.
+
 2007-01-19  Richard Hult  <richard at imendio.com>
 
 	* gconf/gconftool.c: (main): Back out the "killall" change and put

Modified: projects/haf/trunk/gconf2/dbus-tests/test-stale-value-bug.c
===================================================================
--- projects/haf/trunk/gconf2/dbus-tests/test-stale-value-bug.c	2007-05-15 13:20:00 UTC (rev 11661)
+++ projects/haf/trunk/gconf2/dbus-tests/test-stale-value-bug.c	2007-05-15 13:24:20 UTC (rev 11662)
@@ -6,7 +6,8 @@
 #include <gconf/gconf-client.h>
 
 #define KEY_ROOT      "/foo"
-#define KEY_PRIMITIVE KEY_ROOT "/baz_primitive"
+#define KEY_UNCACHED  KEY_ROOT "/baz_primitive"
+#define KEY_PRIMITIVE KEY_ROOT "/bar/baz_primitive"
 #define KEY_PAIR      KEY_ROOT "/bar/baz_pair"
 #define KEY_LIST      KEY_ROOT "/bar/baz_list"
 
@@ -27,7 +28,12 @@
 		g_error_free (error);
 		return FALSE;
 	} 
-	
+
+        if (!str) {
+                g_warning ("String value is NULL\n");
+                return FALSE;
+        }
+        
 	ret = strcmp (str, expected) == 0;
 
 	g_free (str);
@@ -42,6 +48,7 @@
 	GError *error = NULL;
 
 	i = gconf_client_get_int (client, key, &error);
+
 	if (error) {
 		g_error_free (error);
 		i = 0;
@@ -121,32 +128,35 @@
 
 	exists = gconf_client_dir_exists (client, KEY_ROOT, &error);
 	if (error) {
+                g_print ("Error when checking if root exists: %s\n", error->message);
 		g_error_free (error);
 		return FALSE;
 	}
 	if (exists) {
-		/* This is the same as upstream gconf, empty subdirs are not
-		 * clean up right away when they are empty.
-		 */
-		/*g_print ("Root exists\n");
-		  return FALSE;*/
+                /* Note that this might exist or might not. Upstream behaves
+                 * like this too for directories. The values are unset but the
+                 * directory structure still exists, until the next time the
+                 * database is synced to disk.
+                 */
+		/*g_print ("Root exists: %s\n", KEY_ROOT);
+                  return FALSE;*/
 	}
 
 	exists = gconf_client_dir_exists (client, KEY_ROOT "/bar", &error);
 	if (error) {
+                g_print ("Error when checking if dir exists: %s\n", error->message);
 		g_error_free (error);
 		return FALSE;
 	}
 	if (exists) {
-		/* This is the same as upstream gconf, empty subdirs are not
-		 * clean up right away when they are empty.
-		 */
-		/*g_print ("Subdirectory exists\n");
-		  return FALSE;*/
+                /* Same as above. */
+		/*g_print ("Subdirectory exists: %s\n", KEY_ROOT "/bar");
+                  return FALSE;*/
 	}
 
 	value = gconf_client_get (client, KEY_PRIMITIVE, &error);
 	if (error) {
+                g_print ("Error when checking primitie key: %s\n", error->message);
 		g_error_free (error);
 		return FALSE;
 	}
@@ -158,6 +168,7 @@
 	
 	value = gconf_client_get (client, KEY_PAIR, &error);
 	if (error) {
+                g_print ("Error when checking pair key: %s\n", error->message);
 		g_error_free (error);
 		return FALSE;
 	}
@@ -169,6 +180,7 @@
 	
 	value = gconf_client_get (client, KEY_LIST, &error);
 	if (error) {
+                g_print ("Error when checking list key: %s\n", error->message);
 		g_error_free (error);
 		return FALSE;
 	}
@@ -190,6 +202,15 @@
 	gdouble      f;
 	GSList      *list;
 
+	/* String, uncached. */
+	s = g_strdup_printf ("test-%d", g_random_int_range (1, 100));
+	gconf_client_set_string (client, KEY_UNCACHED, s, NULL);
+	if (!check_string (KEY_UNCACHED, s)) {
+		g_print ("Uncached string FAILED\n");
+		exit (1);
+	}
+	g_free (s);
+	
 	/* String. */
 	s = g_strdup_printf ("test-%d", g_random_int_range (1, 100));
 	gconf_client_set_string (client, KEY_PRIMITIVE, s, NULL);
@@ -262,7 +283,7 @@
 	/* Recursive unset. Unset the entire subtree and check that all the keys
 	 * are non-existing.
 	 */
-	gconf_client_recursive_unset (client, KEY_ROOT, 0, NULL);
+    	g_assert (gconf_client_recursive_unset (client, KEY_ROOT, 0, NULL) == TRUE);
 	if (!check_recursive_unset ()) {
 		g_print ("Recursive unset FAILED\n");
 		exit (1);
@@ -284,7 +305,13 @@
 	g_type_init ();
 
 	client = gconf_client_get_default ();
-	
+
+        /* Start out clean in case anything is left from earlier runs. */
+        gconf_client_recursive_unset (client, KEY_ROOT, 0, NULL);
+                
+        /* We add "/foo/bar" so that "/foo" is uncached to test both those
+         * cases.
+         */
 	gconf_client_add_dir (client,
 			      "/foo/bar",
 			      GCONF_CLIENT_PRELOAD_RECURSIVE,

Modified: projects/haf/trunk/gconf2/debian/changelog
===================================================================
--- projects/haf/trunk/gconf2/debian/changelog	2007-05-15 13:20:00 UTC (rev 11661)
+++ projects/haf/trunk/gconf2/debian/changelog	2007-05-15 13:24:20 UTC (rev 11662)
@@ -1,6 +1,11 @@
+gconf2 (2.16.0-1osso4) unstable; urgency=low
+
+  * Fixes: NB#49550, gconf_client_get sees a removed key
+
+ -- Richard Hult <richard at imendio.com>  Tue, 15 May 2007 15:22:55 +0200
+
 gconf2 (2.16.0-1osso3) unstable; urgency=low
 
-  * UNRELEASED
   * Install the gconf path file
 
  -- Richard Hult <richard at imendio.com>  Fri,  2 Mar 2007 11:15:01 +0100


Property changes on: projects/haf/trunk/gconf2/examples
___________________________________________________________________
Name: svn:ignore
   - Makefile.in
.deps
Makefile

   + Makefile.in
.deps
.libs
Makefile
complex-gconf-app
basic-gconf-app
simple-view
simple-controller



Property changes on: projects/haf/trunk/gconf2/gconf
___________________________________________________________________
Name: svn:ignore
   - Makefile.in
.deps
Makefile
gconfmarshal.c
gconfmarshal.h
gconftool-2
gconf.service
.libs
default.path
gconfd-2

   + Makefile.in
.deps
Makefile
gconfmarshal.c
gconfmarshal.h
gconftool-2
gconf.service
.libs
default.path
gconfd-2
gconf-sanity-check-2


Modified: projects/haf/trunk/gconf2/gconf/gconf-client.c
===================================================================
--- projects/haf/trunk/gconf2/gconf/gconf-client.c	2007-05-15 13:20:00 UTC (rev 11661)
+++ projects/haf/trunk/gconf2/gconf/gconf-client.c	2007-05-15 13:24:20 UTC (rev 11662)
@@ -983,7 +983,7 @@
                                GConfEntry  *entry,
                                const gchar *key)
 {
-  if (!strcmp (cached_key, key) == 0)
+  if (strcmp (cached_key, key) == 0)
     {
       gconf_entry_free (entry);
       return TRUE;
@@ -997,7 +997,7 @@
                                            GConfEntry  *entry,
                                            const gchar *key)
 {
-  if (gconf_key_is_below (cached_key, key) == 0)
+  if (gconf_key_is_below (cached_key, key) == 0 || strcmp (cached_key, key) == 0)
     {
       gconf_entry_free (entry);
       return TRUE;


Property changes on: projects/haf/trunk/gconf2/po
___________________________________________________________________
Name: svn:ignore
   - Makefile.in
Makefile
POTFILES
Makefile.in.in

   + Makefile.in
Makefile
POTFILES
Makefile.in.in
*.gmo
stamp-it



More information about the maemo-commits mailing list