Thanks Gavin. I&#39;m assuming that the caller of this method could then just use FdoPtr while getting the return value, or call FDO_SAFE_RELEASE to take care of releasing its share of object ownership. Is that correct? <br>

<br>Many thanks,<br>Snehal<br><br><div class="gmail_quote">On Fri, May 11, 2012 at 11:11 AM, Gavin Cramer <span dir="ltr">&lt;<a href="mailto:gavin.cramer@autodesk.com" target="_blank">gavin.cramer@autodesk.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hi, Snehal.  In your use case is probably the most common for intermediate code that retrieves and also returns ref-counted FDO types.  The only special action
 to take is in the return statement, when it is necessary to increase the ref-count to preserve your method’s “share” of object ownership on behalf of its caller.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">FdoPtr&lt;SomeFdoType&gt; ret;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">ret = CallSomeMethod();<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">return FDO_SAFE_ADDREF(ret.p);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Best wishes,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Gavin<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:fdo-users-bounces@lists.osgeo.org" target="_blank">fdo-users-bounces@lists.osgeo.org</a> [mailto:<a href="mailto:fdo-users-bounces@lists.osgeo.org" target="_blank">fdo-users-bounces@lists.osgeo.org</a>]
<b>On Behalf Of </b>Snehal Joshi<br>
<b>Sent:</b> Friday, May 11, 2012 12:03 PM<br>
<b>To:</b> FDO Users Mail List<br>
<b>Subject:</b> [fdo-users] Memory management and FdoPtr<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi All,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I just started using FDO libraries, and have a question regarding memory management in FDO. I am confused about when to use FdoPtr and FDO_SAFE_ADDREF/FDO_SAFE_RELEASE.
<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Based on the information in the Developer&#39;s Guide, my understanding is that FdoPtr will take care of incrementing the reference count/release the object (provided the class implementes FdoIDisposable) - however, it&#39;ll call Release() as
 soon as the FdoPtr goes out of scope. So, within a function I write, if I wrap the return values of one of the FDO create/get methods in an FdoPtr, and return that FdoPtr as a function return value, it&#39;s a bad idea. Is that a valid assumption?<u></u><u></u></p>


</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Snehal<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div></div></div>
</div>

<br>_______________________________________________<br>
fdo-users mailing list<br>
<a href="mailto:fdo-users@lists.osgeo.org">fdo-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/fdo-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/fdo-users</a><br>
<br></blockquote></div><br>