Nikolay Sivov : dbgeng: Keep event callbacks pointer.

Alexandre Julliard julliard at winehq.org
Thu Apr 11 13:10:31 CDT 2019


Module: wine
Branch: master
Commit: 02da0edd9d2746ddd0d6266a5945608726603e01
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=02da0edd9d2746ddd0d6266a5945608726603e01

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Apr 11 16:03:11 2019 +0300

dbgeng: Keep event callbacks pointer.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 9aed1b0..f9faef0 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 f5d50c8..baec60a 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);




More information about the wine-cvs mailing list