[2/2]wmvcore: add WMMetadataEditor stub implementation - Try 3

Nikolay Sivov bunglehead at gmail.com
Sat Apr 12 01:37:19 CDT 2014


On 4/12/2014 07:33, Jeff Latimer wrote:
> Free the implementation rather that the interface
> ---
>   dlls/wmvcore/wmvcore_main.c | 99
> +++++++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 96 insertions(+), 3 deletions(-)
> +HRESULT WINAPI WMCreateEditor_close(IWMMetadataEditor *iface)
> +{
> +    WMMetadataEditor *This = impl_from_IWMMetadataEditor(iface);
> +    FIXME("(%p)\n", iface);
> +    heap_free(This);
> +    return S_OK;
> +}
> +
> +static ULONG WINAPI WMCreateEditor_Release(IWMMetadataEditor *iface)
> +{
> +    WMMetadataEditor *This = impl_from_IWMMetadataEditor(iface);
> +    ULONG ref = InterlockedDecrement(&This->ref);
> +    TRACE("(%p) ref=%d\n", iface, ref);
> +
> +    if (ref == 0) WMCreateEditor_close(iface);
> +    return ref;
> +}
> +
> +HRESULT WINAPI WMCreateEditor_open(IWMMetadataEditor *iface, const WCHAR *filename)
> +{
> +    if (!filename) return E_POINTER;
> +    FIXME("(%p) filename=%s\n", iface, debugstr_w(filename));
> +    return NS_E_FILE_OPEN_FAILED;
> +}
> +
> +HRESULT WINAPI WMCreateEditor_flush(IWMMetadataEditor *iface)
> +{
> +    FIXME("(%p)\n", iface);
> +    HeapFree(GetProcessHeap(), 0, iface);
> +    return S_OK;
> +}
> +
This is wrong. You can't free implementation pointer like that, only 
Release() should do it. Also please use
natural interface method order for implementation functions and don't 
make them call each other.

So close(), open() and flush() should all return E_NOTIMPL, and have a 
'stub' in a fixme message.



More information about the wine-devel mailing list