X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgregistrysettingsbackend.c;h=cf9da0b79b63e5f00fba07a1a5a03f648d133fbe;hb=f2786908a8858ec9d063e8fae7e4b2d8d612b682;hp=3b3f20a43ec86680001e94192bf5cb83a1d7184f;hpb=d8ca6404229e5b64d2bf2e1a3660ad9fe7feefdd;p=platform%2Fupstream%2Fglib.git diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c index 3b3f20a..cf9da0b 100644 --- a/gio/gregistrysettingsbackend.c +++ b/gio/gregistrysettingsbackend.c @@ -12,9 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library; if not, see . * * Author: Sam Thursfield */ @@ -97,9 +95,6 @@ #include "gsettingsbackend.h" #include "giomodule.h" - -#define _WIN32_WINNT 0x0500 -#define WIN32_LEAN_AND_MEAN #include //#define TRACE @@ -250,7 +245,7 @@ parse_key (const gchar *key_name, gchar *path_name, *c; /* All key paths are treated as absolute; gsettings doesn't seem to enforce a - * preceeding /. + * preceding /. */ if (key_name[0] == '/') key_name ++; @@ -495,7 +490,7 @@ registry_cache_unref_tree (GNode *tree) } } - +#if 0 static void registry_cache_dump (GNode *cache_node, gpointer data) @@ -518,7 +513,7 @@ registry_cache_dump (GNode *cache_node, g_node_children_foreach (cache_node, G_TRAVERSE_ALL, registry_cache_dump, GINT_TO_POINTER (new_depth)); } - +#endif typedef struct { @@ -621,7 +616,7 @@ registry_cache_get_node_for_key (GNode *root, if (key_name[0] == '/') key_name ++; - /* Ignore preceeding / */ + /* Ignore preceding / */ component = g_strdup (key_name); c = strchr (component, '/'); if (c != NULL) @@ -1377,7 +1372,7 @@ watch_handler (RegistryEvent *event) g_object_unref (event->self); g_slice_free (RegistryEvent, event); - return FALSE; + return G_SOURCE_REMOVE; }; @@ -1746,7 +1741,9 @@ watch_add_notify (GRegistryBackend *self, WatchThreadState *watch = self->watch; GNode *cache_node; RegistryCacheItem *cache_item; +#ifdef TRACE DWORD result; +#endif g_return_val_if_fail (watch != NULL, FALSE); trace ("watch_add_notify: prefix %s.\n", gsettings_prefix); @@ -1757,8 +1754,12 @@ watch_add_notify (GRegistryBackend *self, EnterCriticalSection (self->cache_lock); cache_node = registry_cache_get_node_for_key (self->cache_root, gsettings_prefix, TRUE); - g_return_val_if_fail (cache_node != NULL, FALSE); - g_return_val_if_fail (cache_node->data != NULL, FALSE); + if (cache_node == NULL || cache_node->data == NULL) + { + LeaveCriticalSection (self->cache_lock); + g_warn_if_reached (); + return FALSE; + } cache_item = cache_node->data; @@ -1767,6 +1768,7 @@ watch_add_notify (GRegistryBackend *self, { trace ("watch_add_notify: prefix %s already watched, %i subscribers.\n", gsettings_prefix, cache_item->subscription_count); + LeaveCriticalSection (self->cache_lock); return FALSE; } @@ -1788,11 +1790,15 @@ watch_add_notify (GRegistryBackend *self, * one was received. If it takes > 200ms there is a possible race but the worst outcome is * a notification is ignored. */ - result = WaitForSingleObject (watch->message_received_event, 200); - #ifdef TRACE - if (result != WAIT_OBJECT_0) - trace ("watch thread is slow to respond - notification may not be added."); - #endif +#ifdef TRACE + result = +#endif + WaitForSingleObject (watch->message_received_event, 200); +#ifdef TRACE + if (result != WAIT_OBJECT_0) + trace ("watch thread is slow to respond - notification may not be added."); +#endif + LeaveCriticalSection (watch->message_lock); return TRUE; @@ -1912,11 +1918,6 @@ g_registry_backend_unsubscribe (GSettingsBackend *backend, * Object management junk ********************************************************************************/ -GSettingsBackend * -g_registry_backend_new (void) { - return g_object_new (G_TYPE_REGISTRY_BACKEND, NULL); -} - static void g_registry_backend_finalize (GObject *object) {