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