[glib/glib-2-68: 2/6] GWin32RegistryKey: ensure reqeueing works correctly
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-68: 2/6] GWin32RegistryKey: ensure reqeueing works correctly
- Date: Mon, 9 Aug 2021 13:01:32 +0000 (UTC)
commit 22e5e428de9cd8a760f1a6f9ab7362fa4ecce851
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Sat Jul 31 10:57:44 2021 +0000
GWin32RegistryKey: ensure reqeueing works correctly
If a key watch is renewed from the key watch callback, it results
in the callback being NULL, since we clear it after we call it.
Rearrange the function to make sure that the changes done by the
callback function are preserved properly.
gio/gwin32registrykey.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gio/gwin32registrykey.c b/gio/gwin32registrykey.c
index d1ac09041..5e2b006dd 100644
--- a/gio/gwin32registrykey.c
+++ b/gio/gwin32registrykey.c
@@ -2425,17 +2425,20 @@ key_changed (PVOID closure,
ULONG reserved)
{
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_atomic_int_set (&key->priv->change_indicator, G_WIN32_KEY_CHANGED);
g_atomic_int_set (&key->priv->watch_indicator, G_WIN32_KEY_UNWATCHED);
key->priv->update_flags = G_WIN32_REGISTRY_UPDATED_NOTHING;
- if (key->priv->callback)
- key->priv->callback (key, key->priv->user_data);
+ if (callback)
+ callback (key, user_data);
- key->priv->callback = NULL;
- key->priv->user_data = NULL;
g_object_unref (key);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]