[glib/glib-2-68: 1/6] GWin32RegistryKey: Change STATUS_SUCCESS handling




commit d6a734a44ccf8a3a56cc2ddb39956c1f4c117eb2
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Sat Jul 31 10:50:12 2021 +0000

    GWin32RegistryKey: Change STATUS_SUCCESS handling
    
    This function can, in fact, return STATUS_SUCCESS. We shouldn't
    assert that it doesn't.
    
    For now interpret it just like STATUS_PENDING (i.e. APC will be called),
    see how it goes (it isn't documented how the function behaves in this
    case, we have to play it by ear).
    
    Note that while we *can* use a better-documented RegNotifyChangeKeyValue() here,
    it communicates back to us via event objects, which means that the registry
    watcher would have to interact with the main loop directly and insert its
    events (plural; one event per key) there. That would make the API more complicated.
    Whereas the internal NT function communicates by calling an APC - we're good
    as long as something somewhere puts the thread in alertable state.

 gio/gwin32registrykey.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/gio/gwin32registrykey.c b/gio/gwin32registrykey.c
index 398d8f45b..d1ac09041 100644
--- a/gio/gwin32registrykey.c
+++ b/gio/gwin32registrykey.c
@@ -2550,9 +2550,7 @@ g_win32_registry_key_watch (GWin32RegistryKey                   *key,
                                            0,
                                            TRUE);
 
-  g_assert (status != STATUS_SUCCESS);
-
-  if (status == STATUS_PENDING)
+  if (status == STATUS_PENDING || status == STATUS_SUCCESS)
     return TRUE;
 
   g_atomic_int_set (&key->priv->change_indicator, G_WIN32_KEY_UNKNOWN);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]