<?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: Problem Deleting Last Object In The Database in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8217916#M6255</link>
    <description>&lt;P&gt;I think this is the root of it. In the above example, A effectively deletes itself from within it's own &lt;STRONG&gt;subMoveGripPointsAt&lt;/STRONG&gt; function. While this is all inside transactions, I guess it might still be somewhat risky? If I defer the deletion by making a "to be deleted" list which I run through later&amp;nbsp; - then it seems to be fine.&lt;/P&gt;&lt;P&gt;Obviously, up until now it seemed OK...except for the last object in the database thing. Not sure why that makes a difference - does deleting the last object truncate something perhaps?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Aug 2018 20:58:44 GMT</pubDate>
    <dc:creator>Kyudos</dc:creator>
    <dc:date>2018-08-22T20:58:44Z</dc:date>
    <item>
      <title>Problem Deleting Last Object In The Database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8212632#M6249</link>
      <description>&lt;P&gt;This one really has me stumped.&lt;/P&gt;&lt;P&gt;I have two custom objects derived from &lt;STRONG&gt;AcDbBlockReference&lt;/STRONG&gt;. Lets call them A and B. I created B first, so A is the last item in the database. By design, if A is dropped on B (i.e., moved to the same position) A gets deleted. This causes AutoCAD 2018 (and 2017) to crash. However:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;It only crashes if A is the last item in the database.&lt;/LI&gt;&lt;LI&gt;If I draw anything else the deletion is OK.&lt;/LI&gt;&lt;LI&gt;I can delete A manually without a problem in all cases.&lt;/LI&gt;&lt;LI&gt;AUDIT shows no (detectable) problems with the DWG.&lt;/LI&gt;&lt;LI&gt;As far as I can tell, there are no transactions left dangling.&lt;/LI&gt;&lt;LI&gt;The objects are appropriately opened for write.&lt;/LI&gt;&lt;LI&gt;The deletion goes through by &lt;STRONG&gt;DatabaseReactor::objectErased&lt;/STRONG&gt; without issue.&lt;/LI&gt;&lt;LI&gt;If I skip the automatic object deletion....no crash.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Unfortunately, the call stack isn't much use - an Access Violation somewhere in acdb22.dll. It seems very likely the result of something I'm doing (or not doing) - but I don't know how to find out what.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 23:22:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8212632#M6249</guid>
      <dc:creator>Kyudos</dc:creator>
      <dc:date>2018-08-20T23:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting Last Object In The Database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215215#M6250</link>
      <description>&lt;OL&gt;
&lt;LI&gt;Can you provide a sample project that allows to reproduce this issue?&lt;/LI&gt;
&lt;LI&gt;You wrote: "If A is dropped on B ... A gets deleted". Is really A, the dropped object, deleted? So B acts like a trashcan. Or does A replace B and B gets deleted?&lt;/LI&gt;
&lt;LI&gt;When you write "A gets deleted": Do you mean &lt;FONT face="courier new,courier"&gt;A-&amp;gt;erase()&lt;/FONT&gt; or really &lt;FONT face="courier new,courier"&gt;delete A&lt;/FONT&gt; ?&lt;/LI&gt;
&lt;LI&gt;How do you trigger the "delete" process when A is dropped to B?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 21:36:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215215#M6250</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2018-08-21T21:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting Last Object In The Database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215225#M6251</link>
      <description>&lt;P&gt;I doubt I can provide a sample without sending all my code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Might have to try though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The deletion depends on the type of each object and other (complex!) conditions. In this case, the simplest I could make it, neither A nor B has any connections and A is simply deleted. In a more general case, the connections of A would be transferred to B, before A was removed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I say delete, yes I mean calling &lt;FONT face="courier new,courier"&gt;erase&lt;/FONT&gt; for the object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When we move our objects, the 'drop' click triggers a search of that point for things we might need to connect to. Any objects at the dropped point are examined and appropriate connections are made, connections transferred and / or deletions are made.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 21:46:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215225#M6251</guid>
      <dc:creator>Kyudos</dc:creator>
      <dc:date>2018-08-21T21:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting Last Object In The Database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215371#M6252</link>
      <description>&lt;P&gt;It's incredibly ugly, but I could avoid the crash by creating and then deleting a dummy object at the correct time, so that becomes the last in the database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an alternative function to&amp;nbsp;&lt;STRONG&gt;acdbEntLast&lt;/STRONG&gt; that will get me the last object id without selecting the last object?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: Actually I quickly tried this - I just get the crash when deleting the dummy object...&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 23:34:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215371#M6252</guid>
      <dc:creator>Kyudos</dc:creator>
      <dc:date>2018-08-21T23:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting Last Object In The Database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215815#M6253</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you erasing the objects in a reactor callback or inside a command? if you are not erasing the objects inside a command, then please&amp;nbsp;try erasing the objects inside a command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 06:12:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215815#M6253</guid>
      <dc:creator>Virupaksha_aithal</dc:creator>
      <dc:date>2018-08-22T06:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting Last Object In The Database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215893#M6254</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/826400"&gt;@Virupaksha_aithal&lt;/a&gt; - this is actually what I tried to find out with my question "How do you trigger the "delete" process when A is dropped to B?". I agree that erasing it using a registered command is a good advice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I recomment to register a command "MYDROPERASE" with the &lt;FONT face="courier new,courier"&gt;ACRX_CMD_NOHISTORY&lt;/FONT&gt; flag to avoid that this command shows up in the command history. Within the reactor you can call it using&lt;/P&gt;
&lt;PRE&gt;acDocManager-&amp;gt;sendStringToExecute(acDocManager-&amp;gt;curDocument(), L"MYDROPERASE")&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2018 07:07:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8215893#M6254</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2018-08-22T07:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting Last Object In The Database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8217916#M6255</link>
      <description>&lt;P&gt;I think this is the root of it. In the above example, A effectively deletes itself from within it's own &lt;STRONG&gt;subMoveGripPointsAt&lt;/STRONG&gt; function. While this is all inside transactions, I guess it might still be somewhat risky? If I defer the deletion by making a "to be deleted" list which I run through later&amp;nbsp; - then it seems to be fine.&lt;/P&gt;&lt;P&gt;Obviously, up until now it seemed OK...except for the last object in the database thing. Not sure why that makes a difference - does deleting the last object truncate something perhaps?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 20:58:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-deleting-last-object-in-the-database/m-p/8217916#M6255</guid>
      <dc:creator>Kyudos</dc:creator>
      <dc:date>2018-08-22T20:58:44Z</dc:date>
    </item>
  </channel>
</rss>

