On Thu, May 26, 2011 at 06:51:13AM -0500, Adam Martinson wrote: > On 05/26/2011 06:47 AM, Huw Davies wrote: > >On Wed, May 25, 2011 at 12:45:15PM -0500, Adam Martinson wrote: > >>On 05/25/2011 12:36 PM, Adam Martinson wrote: > >>>The AddRef is done in WrapDropTarget(), seems like the appropriate > >>>place for it. Quite right on the rest though, thanks. > >>Oops no, the window prop should be pDropTarget, not the wrapper. > >>The wrapper is only used for the marshalling. > >That window prop could probably go away, I only put it there because > >that's what Windows does, I doubt there's an app that relies on it > >though. However if it stays you do need the AddRef! > > > >Huw. > Best to mirror Windows as close as possible. The AddRef() is done > in WrapDropTarget(). On failure IDropTarget::Release() is done on > the wrapper, which removes the ref on the original.
You're storing a 2nd instance of the ptr (the first being in the wrapper), conventionally you take a 2nd ref. When you remove the window prop you release and when you destroy the wrapper you release again. Huw.
