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:
Руслан Ижбулатов 2021-07-31 10:57:44 +00:00
parent 8c25302726
commit 6885a29428

View File

@ -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);
}