Hi Huw, 2014-06-26 15:54 GMT+08:00 Huw Davies <huw(a)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