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

Jactry Zeng jactry92 at gmail.com
Thu Sep 11 09:01:51 CDT 2014


Hi Huw,
2014-09-11 19:55 GMT+08:00 Huw Davies <huw at codeweavers.com>:
>
>
> 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.

Thanks for your review!

I have tested ref count of reOle/txtDoc in Windows, and ref count
of reOle/txtDoc didn't increase after ITextDocument::Range. So I didn't
call AddRef in ITextDocument::Range.

  create_interfaces(&w, &reOle, &txtDoc, NULL);
  refcount = get_refcount((IUnknown *)txtDoc);
  ok(refcount == 3, "got wrong ref count: %d\n", refcount);
  hres = ITextDocument_Range(txtDoc, 0, 0, &txtRge);
  ok(hres == S_OK, "ITextDocument_Range fails 0x%x.\n", hres);
  refcount = get_refcount((IUnknown *)txtRge);
  ok(refcount == 1, "get wrong refcount: returned %d expected 1\n",
refcount);
  refcount = get_refcount((IUnknown *)txtDoc);
  ok(refcount == 3, "got wrong ref count: %d\n", refcount);


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


More information about the wine-devel mailing list