ole32/ole2: Don't call IDropTarget::QueryInterface() in RegisterDragDrop(). [whitespace fixed]

Huw Davies huw at codeweavers.com
Tue May 24 03:37:08 CDT 2011


> +static IDropTarget* WrapDropTarget(IDropTarget* inner)
> +{
> +    DropTargetWrapper* This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
> +
> +    if (This)
> +    {
> +        This->iface = (IDropTarget){ &DropTargetWrapper_VTbl };

This->iface.lpVtbl = &DropTargetWrapper_VTbl;

> -  hr = CoMarshalInterface(stream, &IID_IDropTarget, unk, MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
> -  IUnknown_Release(unk);
> +  hr = CoMarshalInterface(stream, &IID_IDropTarget, (IUnknown*)wrapper, MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
>  
>    if(SUCCEEDED(hr))
>    {
>      hr = create_map_from_stream(stream, &map);
>      if(SUCCEEDED(hr))
>      {
> -      IDropTarget_AddRef(pDropTarget);
>        SetPropW(hwnd, prop_oledroptarget, pDropTarget);

You probably want to set the window prop to the wrapper here.  Either
way you still need the AddRef (on the wrapper if you set that), it
gets released in RevokeDragDrop.

Huw.



More information about the wine-devel mailing list