[PATCH] riched20: Don't create too many IRichEditOle interfaces for a RichEdit. (try 3)

Jactry Zeng jactry92 at gmail.com
Thu Jun 26 06:10:25 CDT 2014


Hi Huw,
2014-06-26 15:54 GMT+08:00 Huw Davies <huw at codeweavers.com>:
>
>
> I'm sure you can think about how to simplify this a bit.
> The clue that it needs simplification is that you've
> got two AddRef()s in there.
>
> Hint: The code is trying to do two things:
>
> 1. If needed, assign an interface to reOle
> 2. AddRef and return.
>
> > --- a/dlls/riched20/richole.c
> > +++ b/dlls/riched20/richole.c
> > @@ -126,12 +126,13 @@ IRichEditOle_fnRelease(IRichEditOle *me)
> >
> >      TRACE ("%p ref=%u\n", This, ref);
> >
> > -    if (!ref)
> > +    if (ref == 1)
> >      {
> >          TRACE ("Destroying %p\n", This);
> >          This->txtSel->reOle = NULL;
> >          ITextSelection_Release(&This->txtSel->ITextSelection_iface);
> >
 IOleClientSite_Release(&This->clientSite->IOleClientSite_iface);
> > +        This->editor->reOle = NULL;
>
> No, this is wrong.  This function should remain unchanged.
>
> The editor is in charge of the reOle reference, so it
> needs to release it when the editor is destroyed -
> ie in ME_DestroyEditor().
>

I will try again.
Thanks for your review.  :)


-- 
Regards,
Jactry Zeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20140626/99e84d37/attachment.html>


More information about the wine-devel mailing list