Merge branch 'glib-2-68-backport-g-win32-app-info-fixes' into 'glib-2-68'

Backport GWin32AppInfo fixes to glib-2-68

See merge request GNOME/glib!2220
This commit is contained in:
Philip Withnall 2021-08-09 13:01:30 +00:00
commit 94ef9408f7
3 changed files with 15 additions and 9 deletions

View File

@ -1629,6 +1629,7 @@ process_uwp_verbs (GList *verbs,
continue; continue;
} }
acid = NULL;
got_value = g_win32_registry_key_get_value_w (key, got_value = g_win32_registry_key_get_value_w (key,
g_win32_registry_get_os_dirs_w (), g_win32_registry_get_os_dirs_w (),
TRUE, TRUE,
@ -3634,6 +3635,7 @@ grab_registry_string (GWin32RegistryKey *handler_appkey,
if (*destination != NULL) if (*destination != NULL)
return; return;
value = NULL;
if (g_win32_registry_key_get_value_w (handler_appkey, if (g_win32_registry_key_get_value_w (handler_appkey,
NULL, NULL,
TRUE, TRUE,
@ -3828,6 +3830,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 +3840,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 +4035,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);
} }
} }

View File

@ -390,7 +390,7 @@ g_win32_package_parser_enum_packages (GWin32PackageParserCallback callback,
wcs_path = LoadedWindowsGetStringRawBuffer (path, NULL); wcs_path = LoadedWindowsGetStringRawBuffer (path, NULL);
manifest_filename_size = wcslen (wcs_path) + wcslen (bslash_appmanifest); manifest_filename_size = wcslen (wcs_path) + wcslen (bslash_appmanifest);
manifest_filename = g_new (wchar_t, manifest_filename_size + 1); manifest_filename = g_new (wchar_t, manifest_filename_size + 1);
memcpy (manifest_filename, wcs_path, manifest_filename_size * sizeof (wchar_t)); memcpy (manifest_filename, wcs_path, wcslen (wcs_path) * sizeof (wchar_t));
memcpy (&manifest_filename[wcslen (wcs_path)], bslash_appmanifest, (wcslen (bslash_appmanifest) + 1) * sizeof (wchar_t)); memcpy (&manifest_filename[wcslen (wcs_path)], bslash_appmanifest, (wcslen (bslash_appmanifest) + 1) * sizeof (wchar_t));
memset (sax, 0, sizeof (*sax)); memset (sax, 0, sizeof (*sax));

View File

@ -2425,17 +2425,20 @@ key_changed (PVOID closure,
ULONG reserved) ULONG reserved)
{ {
GWin32RegistryKey *key = G_WIN32_REGISTRY_KEY (closure); GWin32RegistryKey *key = G_WIN32_REGISTRY_KEY (closure);
gpointer user_data;
GWin32RegistryKeyWatchCallbackFunc callback;
callback = g_steal_pointer (&key->priv->callback);
user_data = g_steal_pointer (&key->priv->user_data);
g_free (status_block); g_free (status_block);
g_atomic_int_set (&key->priv->change_indicator, G_WIN32_KEY_CHANGED); g_atomic_int_set (&key->priv->change_indicator, G_WIN32_KEY_CHANGED);
g_atomic_int_set (&key->priv->watch_indicator, G_WIN32_KEY_UNWATCHED); g_atomic_int_set (&key->priv->watch_indicator, G_WIN32_KEY_UNWATCHED);
key->priv->update_flags = G_WIN32_REGISTRY_UPDATED_NOTHING; key->priv->update_flags = G_WIN32_REGISTRY_UPDATED_NOTHING;
if (key->priv->callback) if (callback)
key->priv->callback (key, key->priv->user_data); callback (key, user_data);
key->priv->callback = NULL;
key->priv->user_data = NULL;
g_object_unref (key); g_object_unref (key);
} }
@ -2550,9 +2553,7 @@ g_win32_registry_key_watch (GWin32RegistryKey *key,
0, 0,
TRUE); TRUE);
g_assert (status != STATUS_SUCCESS); if (status == STATUS_PENDING || status == STATUS_SUCCESS)
if (status == STATUS_PENDING)
return TRUE; return TRUE;
g_atomic_int_set (&key->priv->change_indicator, G_WIN32_KEY_UNKNOWN); g_atomic_int_set (&key->priv->change_indicator, G_WIN32_KEY_UNKNOWN);