diff options
author | xiaoguang wang <xwang@suse.com> | 2019-02-20 09:26:02 +0800 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2019-02-21 15:19:19 -0500 |
commit | 47d01abe279cf4d5d2f4f3aea934004b87542d69 (patch) | |
tree | e4a5642e098688b57f5be11db8c3021e2e76ec7e /daemon/gdm-display-store.c | |
parent | c2f011d9feb2b86bd4e9dbc267375c24df628825 (diff) | |
download | gdm-47d01abe279cf4d5d2f4f3aea934004b87542d69.tar.gz |
display-store: make foreach ignore callback return value
gdm_display_store_foreach is designed to iterate through all
displays in the display store. Under the hood, it currently
uses gdm_display_store_find, though, so will prematurely stop
it's loop if a callback returns TRUE. Callers are getting this
wrong. Some return TRUE with the expectation it goes on, and
some fail to return a value at all.
This commit changes gdm_display_store_foreach to use
g_hash_table_foreach instead, so the callback return values no
longer matter.
Diffstat (limited to 'daemon/gdm-display-store.c')
-rw-r--r-- | daemon/gdm-display-store.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/daemon/gdm-display-store.c b/daemon/gdm-display-store.c index fd24334e..910468cd 100644 --- a/daemon/gdm-display-store.c +++ b/daemon/gdm-display-store.c @@ -146,6 +146,16 @@ find_func (const char *id, closure->user_data); } +static void +foreach_func (const char *id, + StoredDisplay *stored_display, + FindClosure *closure) +{ + (void) closure->predicate (id, + stored_display->display, + closure->user_data); +} + void gdm_display_store_foreach (GdmDisplayStore *store, GdmDisplayStoreFunc func, @@ -159,9 +169,9 @@ gdm_display_store_foreach (GdmDisplayStore *store, closure.predicate = func; closure.user_data = user_data; - g_hash_table_find (store->priv->displays, - (GHRFunc) find_func, - &closure); + g_hash_table_foreach (store->priv->displays, + (GHFunc) foreach_func, + &closure); } GdmDisplay * |