<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Smartpointer question? in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/smartpointer-question/m-p/10180791#M3546</link>
    <description>&lt;P&gt;Thank sir!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;I got it.&lt;/SPAN&gt; &lt;SPAN class="JLqJ4b ChMk0b"&gt;maybe&amp;nbsp;&lt;/SPAN&gt;I'll save it for other cases.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":right_anger_bubble:"&gt;🗯&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Mar 2021 21:18:18 GMT</pubDate>
    <dc:creator>D_D_K</dc:creator>
    <dc:date>2021-03-23T21:18:18Z</dc:date>
    <item>
      <title>Smartpointer question?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/smartpointer-question/m-p/10180492#M3544</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;can I combine AcDbObjectPointer and AcDbVoidPtrArray ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;The problem I'm having is the pointer doesn't seem to be valid after the end of the function.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;How do I use smartpointer in this case?&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;because I want to avoid delete pointer.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;bool Dosomething(AcDbCircle* c,...); //

void myfunc(AcDbVoidPtrArray &amp;amp;vrr){
AcDbObjectPointer&amp;lt;CIR&amp;gt; cptr; cptr.create();
CIR* cir = cptr.object();
if (Dosomething(cir,...))
   vrr.append(cir);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;Thanks for the explanation.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 19:32:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/smartpointer-question/m-p/10180492#M3544</guid>
      <dc:creator>D_D_K</dc:creator>
      <dc:date>2021-03-23T19:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Smartpointer question?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/smartpointer-question/m-p/10180511#M3545</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4231883"&gt;@D_D_K&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;can I combine AcDbObjectPointer and AcDbVoidPtrArray ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;The problem I'm having is the pointer doesn't seem to be valid after the end of the function.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;How do I use smartpointer in this case?&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;because I want to avoid delete pointer.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;bool Dosomething(AcDbCircle* c,...); //

void myfunc(AcDbVoidPtrArray &amp;amp;vrr){
AcDbObjectPointer&amp;lt;CIR&amp;gt; cptr; cptr.create();
CIR* cir = cptr.object();
if (Dosomething(cir,...))
   vrr.append(cir);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;Thanks for the explanation.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;bool Dosomething(AcDbCircle* c,...); //

void myfunc(AcDbVoidPtrArray &amp;amp;vrr){
AcDbObjectPointer&amp;lt;CIR&amp;gt; cptr; cptr.create();
CIR* cir = cptr.object();
if (Dosomething(cir,...)) {
   CIR *cir1 = NULL;
   cir.release(cir1); // &amp;lt;- prevent from destructor
   vrr.append(cir1);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other way is not using smart pointer in this case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 19:46:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/smartpointer-question/m-p/10180511#M3545</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2021-03-23T19:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Smartpointer question?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/smartpointer-question/m-p/10180791#M3546</link>
      <description>&lt;P&gt;Thank sir!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;I got it.&lt;/SPAN&gt; &lt;SPAN class="JLqJ4b ChMk0b"&gt;maybe&amp;nbsp;&lt;/SPAN&gt;I'll save it for other cases.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":right_anger_bubble:"&gt;🗯&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 21:18:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/smartpointer-question/m-p/10180791#M3546</guid>
      <dc:creator>D_D_K</dc:creator>
      <dc:date>2021-03-23T21:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Smartpointer question?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/smartpointer-question/m-p/11258811#M3547</link>
      <description>&lt;P&gt;Good morning , I have a question .&lt;/P&gt;&lt;P&gt;With the above sample , when AcDbObjectPtrArray vrr go out of its scope in main function , do we need to delete or close its member 's pointers ?&lt;/P&gt;&lt;P&gt;I also have the similar code in which i'm using AcDbObjectPtrArray.&lt;/P&gt;&lt;P&gt;Thanks in advance !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;AcDbVoidPtrArray lineObjs;
    AcDbObjectPointer&amp;lt;AcDbLine&amp;gt; tempLine;
    AcDbObjectId oId;
    ads_point startPnt, nextPnt;

    acedGetPoint(NULL, _T("\nStart point : "), startPnt);

    for (int i = 0; i &amp;lt; 10; i++)
    {
        acedGetPoint(startPnt, _T("\nNext point : "), nextPnt);
       
        tempLine.create();
        tempLine-&amp;gt;setStartPoint(asPnt3d(startPnt));
        tempLine-&amp;gt;setEndPoint(asPnt3d(nextPnt));
        tempLine-&amp;gt;setLayer(_T("1"));

        addToCurSpace(oId, tempLine);

        AcDbLine* pTemp = nullptr;
        tempLine.release(pTemp);

        lineObjs.append(pTemp);

        acdbPointSet(nextPnt, startPnt);
    } 

    acutPrintf(_T("\nNumber of lines : %d"), lineObjs.length());
    //&amp;lt;- do we need to delete or close AcDbVoidPtrArray 's member pointer here ?
    //If not does it cause memory leak ?&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jun 2022 02:29:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/smartpointer-question/m-p/11258811#M3547</guid>
      <dc:creator>trithuongle</dc:creator>
      <dc:date>2022-06-26T02:29:30Z</dc:date>
    </item>
  </channel>
</rss>

