/* i_drop_target must be the first member. */
IDropTarget i_drop_target;
HWND hwnd;
+ int ref_count;
};
static HRESULT STDMETHODCALLTYPE
static ULONG STDMETHODCALLTYPE
w32_drop_target_AddRef (IDropTarget *This)
{
- return 1;
+ struct w32_drop_target *target = (struct w32_drop_target *) This;
+ return ++target->ref_count;
}
static ULONG STDMETHODCALLTYPE
w32_drop_target_Release (IDropTarget *This)
{
struct w32_drop_target *target = (struct w32_drop_target *) This;
+ if (--target->ref_count > 0)
+ return target->ref_count;
free (target->i_drop_target.lpVtbl);
free (target);
return 0;
if (vtbl != NULL)
{
drop_target->hwnd = hwnd;
+ drop_target->ref_count = 0;
drop_target->i_drop_target.lpVtbl = vtbl;
vtbl->QueryInterface = w32_drop_target_QueryInterface;
vtbl->AddRef = w32_drop_target_AddRef;