On 1/8/2012 20:47, André Hentschel wrote:
dlls/d3drm/frame.c | 11 +++++++---- dlls/d3drm/tests/d3drm.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index 212f7dd..b72700c 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -33,6 +33,7 @@ typedef struct { IDirect3DRMFrame2 IDirect3DRMFrame2_iface; IDirect3DRMFrame3 IDirect3DRMFrame3_iface; LONG ref;
- LPVOID parent; } IDirect3DRMFrameImpl;
Parent is store as another frame interface pointer, right? Why void* here?
static const struct IDirect3DRMFrame2Vtbl Direct3DRMFrame2_Vtbl; @@ -336,9 +337,10 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_GetParent(IDirect3DRMFrame2* iface, { IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
- FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
- TRACE("(%p/%p)->(%p)\n", iface, This, frame);
- return E_NOTIMPL;
- *frame = This->parent;
- return D3DRM_OK; }
What looks suspicious is reference counting handling, or absence of it in other words. I'm not familiar with d3d, but this needs tests for parent refcount - is it increased when it's stored? is it properly freed? is it increased after GetParent()?
Am 08.01.2012 20:02, schrieb Nikolay Sivov:
On 1/8/2012 20:47, André Hentschel wrote:
dlls/d3drm/frame.c | 11 +++++++---- dlls/d3drm/tests/d3drm.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index 212f7dd..b72700c 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -33,6 +33,7 @@ typedef struct { IDirect3DRMFrame2 IDirect3DRMFrame2_iface; IDirect3DRMFrame3 IDirect3DRMFrame3_iface; LONG ref;
- LPVOID parent; } IDirect3DRMFrameImpl;
Parent is store as another frame interface pointer, right? Why void* here?
static const struct IDirect3DRMFrame2Vtbl Direct3DRMFrame2_Vtbl; @@ -336,9 +337,10 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_GetParent(IDirect3DRMFrame2* iface, { IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
- FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
- TRACE("(%p/%p)->(%p)\n", iface, This, frame);
- return E_NOTIMPL;
- *frame = This->parent;
- return D3DRM_OK; }
What looks suspicious is reference counting handling, or absence of it in other words. I'm not familiar with d3d, but this needs tests for parent refcount - is it increased when it's stored? is it properly freed? is it increased after GetParent()?
true, I'll add tests in next patchset
Am 08.01.2012 20:02, schrieb Nikolay Sivov:
On 1/8/2012 20:47, André Hentschel wrote:
dlls/d3drm/frame.c | 11 +++++++---- dlls/d3drm/tests/d3drm.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index 212f7dd..b72700c 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -33,6 +33,7 @@ typedef struct { IDirect3DRMFrame2 IDirect3DRMFrame2_iface; IDirect3DRMFrame3 IDirect3DRMFrame3_iface; LONG ref;
- LPVOID parent; } IDirect3DRMFrameImpl;
Parent is store as another frame interface pointer, right? Why void* here?
Didn't read that at first time. I wanted to access parent as LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME2 and maybe LPDIRECT3DRMFRAME3
On 01/09/2012 09:42 PM, André Hentschel wrote:
Am 08.01.2012 20:02, schrieb Nikolay Sivov:
On 1/8/2012 20:47, André Hentschel wrote:
dlls/d3drm/frame.c | 11 +++++++---- dlls/d3drm/tests/d3drm.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index 212f7dd..b72700c 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -33,6 +33,7 @@ typedef struct { IDirect3DRMFrame2 IDirect3DRMFrame2_iface; IDirect3DRMFrame3 IDirect3DRMFrame3_iface; LONG ref;
- LPVOID parent; } IDirect3DRMFrameImpl;
Parent is store as another frame interface pointer, right? Why void* here?
Didn't read that at first time. I wanted to access parent as LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME2 and maybe LPDIRECT3DRMFRAME3
Store the object in the parent pointer and then you can easily return a pointer to all interfaces implemented by the parent in a type safe manner: IDirect3DRMFrameImpl *parent;
bye michael
Am 09.01.2012 22:33, schrieb Michael Stefaniuc:
On 01/09/2012 09:42 PM, André Hentschel wrote:
Am 08.01.2012 20:02, schrieb Nikolay Sivov:
On 1/8/2012 20:47, André Hentschel wrote:
dlls/d3drm/frame.c | 11 +++++++---- dlls/d3drm/tests/d3drm.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index 212f7dd..b72700c 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -33,6 +33,7 @@ typedef struct { IDirect3DRMFrame2 IDirect3DRMFrame2_iface; IDirect3DRMFrame3 IDirect3DRMFrame3_iface; LONG ref;
- LPVOID parent; } IDirect3DRMFrameImpl;
Parent is store as another frame interface pointer, right? Why void* here?
Didn't read that at first time. I wanted to access parent as LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME2 and maybe LPDIRECT3DRMFRAME3
Store the object in the parent pointer and then you can easily return a pointer to all interfaces implemented by the parent in a type safe manner: IDirect3DRMFrameImpl *parent;
bye michael
good idea, thx
On 1/9/2012 23:42, André Hentschel wrote:
Am 08.01.2012 20:02, schrieb Nikolay Sivov:
On 1/8/2012 20:47, André Hentschel wrote:
dlls/d3drm/frame.c | 11 +++++++---- dlls/d3drm/tests/d3drm.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index 212f7dd..b72700c 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -33,6 +33,7 @@ typedef struct { IDirect3DRMFrame2 IDirect3DRMFrame2_iface; IDirect3DRMFrame3 IDirect3DRMFrame3_iface; LONG ref;
- LPVOID parent; } IDirect3DRMFrameImpl;
Parent is store as another frame interface pointer, right? Why void* here?
Didn't read that at first time. I wanted to access parent as LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME2 and maybe LPDIRECT3DRMFRAME3
You mean access IDirect3DRMFrameImpl through that pointer? It's better to avoid that if possible, I mean a preferred way is to use interface methods when interface pointer is supplied by a caller instead of relying on internal implementation. It's not always possible of course, but still.