[PATCH 2/2] dbgeng: Keep event callbacks pointer.

Nikolay Sivov nsivov at codeweavers.com
Thu Apr 11 08:03:11 CDT 2019


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/dbgeng/dbgeng.c       | 26 ++++++++++++++++++++++----
 dlls/dbgeng/tests/dbgeng.c |  1 -
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/dlls/dbgeng/dbgeng.c b/dlls/dbgeng/dbgeng.c
index 9aed1b0506..f9faef06dd 100644
--- a/dlls/dbgeng/dbgeng.c
+++ b/dlls/dbgeng/dbgeng.c
@@ -51,6 +51,7 @@ struct debug_client
     LONG refcount;
     ULONG engine_options;
     struct list targets;
+    IDebugEventCallbacks *event_callbacks;
 };
 
 static struct debug_client *impl_from_IDebugClient(IDebugClient *iface)
@@ -133,6 +134,8 @@ static ULONG STDMETHODCALLTYPE debugclient_Release(IDebugClient *iface)
             list_remove(&cur->entry);
             heap_free(cur);
         }
+        if (debug_client->event_callbacks)
+            debug_client->event_callbacks->lpVtbl->Release(debug_client->event_callbacks);
         heap_free(debug_client);
     }
 
@@ -467,16 +470,31 @@ static HRESULT STDMETHODCALLTYPE debugclient_OutputIdentity(IDebugClient *iface,
 
 static HRESULT STDMETHODCALLTYPE debugclient_GetEventCallbacks(IDebugClient *iface, IDebugEventCallbacks **callbacks)
 {
-    FIXME("%p, %p stub.\n", iface, callbacks);
+    struct debug_client *debug_client = impl_from_IDebugClient(iface);
 
-    return E_NOTIMPL;
+    TRACE("%p, %p.\n", iface, callbacks);
+
+    if (debug_client->event_callbacks)
+    {
+        *callbacks = debug_client->event_callbacks;
+        (*callbacks)->lpVtbl->AddRef(*callbacks);
+    }
+
+    return S_OK;
 }
 
 static HRESULT STDMETHODCALLTYPE debugclient_SetEventCallbacks(IDebugClient *iface, IDebugEventCallbacks *callbacks)
 {
-    FIXME("%p, %p stub.\n", iface, callbacks);
+    struct debug_client *debug_client = impl_from_IDebugClient(iface);
 
-    return E_NOTIMPL;
+    TRACE("%p, %p.\n", iface, callbacks);
+
+    if (debug_client->event_callbacks)
+        debug_client->event_callbacks->lpVtbl->Release(debug_client->event_callbacks);
+    if ((debug_client->event_callbacks = callbacks))
+        debug_client->event_callbacks->lpVtbl->AddRef(debug_client->event_callbacks);
+
+    return S_OK;
 }
 
 static HRESULT STDMETHODCALLTYPE debugclient_FlushCallbacks(IDebugClient *iface)
diff --git a/dlls/dbgeng/tests/dbgeng.c b/dlls/dbgeng/tests/dbgeng.c
index f5d50c899a..baec60a9c9 100644
--- a/dlls/dbgeng/tests/dbgeng.c
+++ b/dlls/dbgeng/tests/dbgeng.c
@@ -247,7 +247,6 @@ static void test_attach(void)
     ok(hr == S_OK, "Failed to get interface pointer, hr %#x.\n", hr);
 
     hr = client->lpVtbl->SetEventCallbacks(client, &event_callbacks);
-todo_wine
     ok(hr == S_OK, "Failed to set event callbacks, hr %#x.\n", hr);
 
     event = CreateEventA(NULL, FALSE, FALSE, event_name);
-- 
2.20.1




More information about the wine-devel mailing list