mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 21:33:09 +02:00
GWin32AppInfo: re-trigger registry watcher from the callback
To ensure that the watch is properly re-set every time, call watch_keys() from the watch callback. Previously the watch was only renewed after a data update was done in a worker thread, which made no sense, since the update function was implemented in such a way that it can (and should) be re-triggered on each key change, until the changes stop coming, and that can only happen if we renew the registry watcher right away.
This commit is contained in:
parent
6885a29428
commit
4e9e7bfd34
@ -3828,6 +3828,9 @@ update_registry_data (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
watch_keys (void);
|
||||||
|
|
||||||
/* This function is called when any of our registry watchers detect
|
/* This function is called when any of our registry watchers detect
|
||||||
* changes in the registry.
|
* changes in the registry.
|
||||||
*/
|
*/
|
||||||
@ -3835,6 +3838,7 @@ static void
|
|||||||
keys_updated (GWin32RegistryKey *key,
|
keys_updated (GWin32RegistryKey *key,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
watch_keys ();
|
||||||
/* Indicate the tree as not up-to-date, push a new job for the AppInfo thread */
|
/* Indicate the tree as not up-to-date, push a new job for the AppInfo thread */
|
||||||
g_atomic_int_inc (&gio_win32_appinfo_update_counter);
|
g_atomic_int_inc (&gio_win32_appinfo_update_counter);
|
||||||
/* We don't use the data pointer, but it must be non-NULL */
|
/* We don't use the data pointer, but it must be non-NULL */
|
||||||
@ -4029,7 +4033,6 @@ gio_win32_appinfo_init (gboolean do_wait)
|
|||||||
g_mutex_lock (&gio_win32_appinfo_mutex);
|
g_mutex_lock (&gio_win32_appinfo_mutex);
|
||||||
while (g_atomic_int_get (&gio_win32_appinfo_update_counter) > 0)
|
while (g_atomic_int_get (&gio_win32_appinfo_update_counter) > 0)
|
||||||
g_cond_wait (&gio_win32_appinfo_cond, &gio_win32_appinfo_mutex);
|
g_cond_wait (&gio_win32_appinfo_cond, &gio_win32_appinfo_mutex);
|
||||||
watch_keys ();
|
|
||||||
g_mutex_unlock (&gio_win32_appinfo_mutex);
|
g_mutex_unlock (&gio_win32_appinfo_mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user