[PATCH 1/8] riched20: Stub for ITextRange interface and implement ITextDocument::Range. (resend try 4)

Huw Davies huw at codeweavers.com
Thu Sep 11 06:55:36 CDT 2014


On Thu, Sep 11, 2014 at 05:35:38PM +0800, Jactry Zeng wrote:
> +static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end,
> +                                ITextRangeImpl *txtRge, ITextRange** ppRange)
> +{
> +    txtRge->ITextRange_iface.lpVtbl = &trvt;
> +    txtRge->ref = 1;
> +    txtRge->reOle = reOle;
> +    txtRge->start = start;
> +    txtRge->end = end;
> +    list_add_head(&reOle->rangelist, &txtRge->entry);
> +    *ppRange = &txtRge->ITextRange_iface;
> +    return S_OK;
> +}

This looks very suspicious to me.  You're storing a reference to
'reOle' so you should AddRef it somewhere.  It may be better to pass
the interface ptr, AddRef and store that.

Also, is the purpose of rangelist just to be able to NULL out reOle
when the parent object is destroyed?  If so, this can go away if you
correctly handle the ref counting.

Huw.



More information about the wine-devel mailing list