<?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 Bug Related to AcDbMText That Causes AutoCAD Crash in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/bug-related-to-acdbmtext-that-causes-autocad-crash/m-p/11992832#M1735</link>
    <description>&lt;P&gt;Following are the key points:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Add a command CreatText in ObjectARX.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;const ACHAR* pContent = L"AA";
void CreateText()
{
	AcDbMText* pText = new AcDbMText();
	AppendDb(pText);
	auto id = pText-&amp;gt;objectId();
	pText-&amp;gt;close();
	pText = nullptr;
	acdbOpenAcDbEntity((AcDbEntity*&amp;amp;)pText, id, AcDb::kForWrite);
	pText-&amp;gt;setContents(pContent);
	pText-&amp;gt;close();
	pText = nullptr;
}

Acad::ErrorStatus AppendDb(AcDbEntity* pEntity, const std::wstring&amp;amp; sBlkRec = ACDB_MODEL_SPACE, AcDbDatabase* pDb = acdbCurDwg())
{
	Acad::ErrorStatus es = eNotImplementedYet;

	AcDbBlockTableRecordPointer pBlockTableRecord(sBlkRec.c_str(), pDb, AcDb::kForWrite);
	if ((es = pBlockTableRecord.openStatus()) != Acad::eOk)
		return es;

	return pBlockTableRecord-&amp;gt;appendAcDbEntity(pEntity);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Execute the command.&lt;/LI&gt;&lt;LI&gt;Undo .&lt;/LI&gt;&lt;LI&gt;Attempt to close the drawing, choose not to save, then AutoCAD crashes.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This issue occurs both in AutoCAD 2018 and 2022.&lt;/P&gt;</description>
    <pubDate>Sat, 27 May 2023 22:21:55 GMT</pubDate>
    <dc:creator>3453351159</dc:creator>
    <dc:date>2023-05-27T22:21:55Z</dc:date>
    <item>
      <title>Bug Related to AcDbMText That Causes AutoCAD Crash</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/bug-related-to-acdbmtext-that-causes-autocad-crash/m-p/11992832#M1735</link>
      <description>&lt;P&gt;Following are the key points:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Add a command CreatText in ObjectARX.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;const ACHAR* pContent = L"AA";
void CreateText()
{
	AcDbMText* pText = new AcDbMText();
	AppendDb(pText);
	auto id = pText-&amp;gt;objectId();
	pText-&amp;gt;close();
	pText = nullptr;
	acdbOpenAcDbEntity((AcDbEntity*&amp;amp;)pText, id, AcDb::kForWrite);
	pText-&amp;gt;setContents(pContent);
	pText-&amp;gt;close();
	pText = nullptr;
}

Acad::ErrorStatus AppendDb(AcDbEntity* pEntity, const std::wstring&amp;amp; sBlkRec = ACDB_MODEL_SPACE, AcDbDatabase* pDb = acdbCurDwg())
{
	Acad::ErrorStatus es = eNotImplementedYet;

	AcDbBlockTableRecordPointer pBlockTableRecord(sBlkRec.c_str(), pDb, AcDb::kForWrite);
	if ((es = pBlockTableRecord.openStatus()) != Acad::eOk)
		return es;

	return pBlockTableRecord-&amp;gt;appendAcDbEntity(pEntity);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Execute the command.&lt;/LI&gt;&lt;LI&gt;Undo .&lt;/LI&gt;&lt;LI&gt;Attempt to close the drawing, choose not to save, then AutoCAD crashes.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This issue occurs both in AutoCAD 2018 and 2022.&lt;/P&gt;</description>
      <pubDate>Sat, 27 May 2023 22:21:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/bug-related-to-acdbmtext-that-causes-autocad-crash/m-p/11992832#M1735</guid>
      <dc:creator>3453351159</dc:creator>
      <dc:date>2023-05-27T22:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Related to AcDbMText That Causes AutoCAD Crash</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/bug-related-to-acdbmtext-that-causes-autocad-crash/m-p/11993618#M1736</link>
      <description>&lt;P&gt;Very strange code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-cpp" tabindex="0"&gt;&lt;CODE&gt;pText-&amp;gt;setContents(pText);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 May 2023 19:39:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/bug-related-to-acdbmtext-that-causes-autocad-crash/m-p/11993618#M1736</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2023-05-27T19:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Related to AcDbMText That Causes AutoCAD Crash</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/bug-related-to-acdbmtext-that-causes-autocad-crash/m-p/11993827#M1737</link>
      <description>&lt;P&gt;I'm sorry, I posted a error code.It has been fixed now. However, this doesn't affect the test results.&lt;/P&gt;</description>
      <pubDate>Sat, 27 May 2023 22:30:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/bug-related-to-acdbmtext-that-causes-autocad-crash/m-p/11993827#M1737</guid>
      <dc:creator>3453351159</dc:creator>
      <dc:date>2023-05-27T22:30:08Z</dc:date>
    </item>
  </channel>
</rss>

