mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
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.
This commit is contained in:
parent
8c25302726
commit
6885a29428
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user