mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 14:43:38 +00:00
d3drm: Remove first found callback, not all of them.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7c0b1b6268
commit
d5d1a288e9
|
@ -77,17 +77,18 @@ HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJE
|
|||
|
||||
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx)
|
||||
{
|
||||
struct destroy_callback *callback, *callback2;
|
||||
struct destroy_callback *callback;
|
||||
|
||||
if (!cb)
|
||||
return D3DRMERR_BADVALUE;
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE(callback, callback2, &object->destroy_callbacks, struct destroy_callback, entry)
|
||||
LIST_FOR_EACH_ENTRY(callback, &object->destroy_callbacks, struct destroy_callback, entry)
|
||||
{
|
||||
if (callback->cb == cb && callback->ctx == ctx)
|
||||
{
|
||||
list_remove(&callback->entry);
|
||||
HeapFree(GetProcessHeap(), 0, callback);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1355,6 +1355,26 @@ static void test_Viewport(void)
|
|||
IDirect3DRMViewport_Release(viewport);
|
||||
ok(context.called == 3, "got %d, expected 3\n", context.called);
|
||||
|
||||
/* test this pattern - add cb1, add cb2, add cb1, delete cb1 */
|
||||
hr = IDirect3DRM_CreateViewport(d3drm, device, frame, rc.left, rc.top, rc.right, rc.bottom, &viewport);
|
||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMViewport interface (hr = %x)\n", hr);
|
||||
|
||||
hr = IDirect3DRMViewport_AddDestroyCallback(viewport, destroy_callback, &context);
|
||||
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
|
||||
|
||||
hr = IDirect3DRMViewport_AddDestroyCallback(viewport, destroy_callback1, &context);
|
||||
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
|
||||
|
||||
hr = IDirect3DRMViewport_AddDestroyCallback(viewport, destroy_callback, &context);
|
||||
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
|
||||
|
||||
hr = IDirect3DRMViewport_DeleteDestroyCallback(viewport, destroy_callback, &context);
|
||||
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
|
||||
|
||||
context.called = 0;
|
||||
IDirect3DRMViewport_Release(viewport);
|
||||
ok(context.called == 2, "got %d, expected 2\n", context.called);
|
||||
|
||||
/* destroy from Viewport2 */
|
||||
hr = IDirect3DRM_CreateViewport(d3drm, device, frame, rc.left, rc.top, rc.right, rc.bottom, &viewport);
|
||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMViewport interface (hr = %x)\n", hr);
|
||||
|
@ -1395,6 +1415,30 @@ static void test_Viewport(void)
|
|||
IDirect3DRMViewport2_Release(viewport2);
|
||||
ok(context.called == 3, "got %d, expected 3\n", context.called);
|
||||
|
||||
/* test this pattern - add cb1, add cb2, add cb1, delete cb1 */
|
||||
hr = IDirect3DRM_CreateViewport(d3drm, device, frame, rc.left, rc.top, rc.right, rc.bottom, &viewport);
|
||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMViewport interface (hr = %x)\n", hr);
|
||||
|
||||
hr = IDirect3DRMViewport_QueryInterface(viewport, &IID_IDirect3DRMViewport2, (void**)&viewport2);
|
||||
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
|
||||
IDirect3DRMViewport_Release(viewport);
|
||||
|
||||
hr = IDirect3DRMViewport2_AddDestroyCallback(viewport2, destroy_callback, &context);
|
||||
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
|
||||
|
||||
hr = IDirect3DRMViewport2_AddDestroyCallback(viewport2, destroy_callback1, &context);
|
||||
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
|
||||
|
||||
hr = IDirect3DRMViewport2_AddDestroyCallback(viewport2, destroy_callback, &context);
|
||||
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
|
||||
|
||||
hr = IDirect3DRMViewport2_DeleteDestroyCallback(viewport2, destroy_callback, &context);
|
||||
ok(hr == D3DRM_OK, "expected D3DRM_OK (hr = %x)\n", hr);
|
||||
|
||||
context.called = 0;
|
||||
IDirect3DRMViewport2_Release(viewport2);
|
||||
ok(context.called == 2, "got %d, expected 2\n", context.called);
|
||||
|
||||
IDirect3DRMFrame_Release(frame);
|
||||
IDirect3DRMDevice_Release(device);
|
||||
IDirectDrawClipper_Release(pClipper);
|
||||
|
|
Loading…
Reference in a new issue