<?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 APIDb_ChangeCurrentDatabaseID crashing in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/APIDb-ChangeCurrentDatabaseID-crashing/m-p/368247#M1352</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am building a plugin and the following constellation keeps crashing more often than not and I don't really understand why:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Open a Solo project&lt;/LI&gt;&lt;LI&gt;Create a worksheet by right clicking on worksheets -&amp;gt; new worksheet in the Navigator&lt;/LI&gt;&lt;LI&gt;Run the plugin from the menu&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;In the plugin it crashes when I try to switch to the database of the Floorplan, or if I call APIDo_ChangeWindowID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;API_DatabaseInfo    origDB, planDB;
BNZeroMemory(&amp;amp;planDB, sizeof(API_DatabaseInfo));
planDB.typeID = APIWind_FloorPlanID;
ACAPI_Database(APIDb_GetCurrentDatabaseID, &amp;amp;origDB, nullptr);
// next line will crash
ACAPI_Database(APIDb_ChangeCurrentDatabaseID, &amp;amp;planDB, nullptr);

// using this instead will crash as well:
API_WindowInfo windInfo = {};
windInfo.typeID = APIWind_FloorPlanID;
ACAPI_Automate(APIDo_ChangeWindowID, &amp;amp;windInfo);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is happening in AC25 on windows 10, running in release with debug info.&lt;/P&gt;&lt;P&gt;The strange thing is that it sometimes does not crash, for example if there are elements in the floorplan database like sections.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Crash report:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;//================= BEGIN REPORT ======================

Computer-name: DESKTOP-D4LEQVE
User-name    : suppo
Account name : suppo
Domain name  : DESKTOP-D4LEQVE

Computer-name: d7975a9c6ccca512f607154d6ac02d2fb14e1f2c9ce2b0c9d7f993dd9ff7d368
User-name    : c49a59749971193cba65fe48ec9d59dd5fce536c41ce841b834bec87821db22f
Account name : c49a59749971193cba65fe48ec9d59dd5fce536c41ce841b834bec87821db22f
Domain name  : d7975a9c6ccca512f607154d6ac02d2fb14e1f2c9ce2b0c9d7f993dd9ff7d368

Program Version: 25.0.0 R1 (4013)
 (64-bit)

Package Version: v2021 FULL INT 4013
Command Line: &amp;lt;"C:\Program Files\Graphisoft\ARCHICAD 25 INT\ARCHICAD.exe" -DEMO&amp;gt;
Process ID  : 17048
Thread  ID  : 16216 
GL_VENDOR: NVIDIA Corporation
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: NVIDIA GeForce RTX 2060/PCIe/SSE2
GL_RENDERER: NVIDIA GeForce RTX 2060/PCIe/SSE2
GL_VERSION: 4.6.0 NVIDIA 516.94
GL_VERSION: 4.6.0 NVIDIA 516.94
LicenseData: DemoMode
LicenseData: DemoMode
LicenseDataEDS: DemoMode
LicenseDataEDS: DemoMode
ProjectName: Untitled
ProjectName: 094b7511d1feca678ff65f27355f9d3f9dda59290a30c6e4f72cfc0c99cc9529
ProjectFileName-ProjectOpeningProcess: ARCHICAD 25 Template.tpl
ProjectFileName-ProjectOpeningProcess: 3d9be14fc328a5d6c6d0f05fb37b9e3ebf5a5323cdbc7a1dca7811d82d270aea
OS Version  : Windows WorkStation (10.0) 10.0.19045 (64-bit) 

Session start: 2023/01/20 15:31:01
System time: 2023/01/20 15:34:14

ODB assertion failed at P:\VMWD\Build\Sources\ObjectDatabase\ObjectDatabaseDll\Database\ODBDatabase.cpp 2463
    assert id: 8050C8D9-04C5-41A6-A9E2-90F0D4C95482
    description: database modification is not allowed for the current thread
    class:    WM::WindowState
    id:       36CC92C4-C8B6-443E-9136-8575E02A924E
    idSpace:  ACP::UserProject
    database: ACP::UserProject
    flags:    Internal, WasInternalFlag, Loadable, HadInternalLinksFlag, HasOwnerObjectFlag, ObjectModifiedOnTraceLine1, ObjectModifiedOnTraceLine3, LinkModifiedOnTraceLine1, Pinned, ModifiableWithoutModificationScope, DataLayerBit1, DataLayerBit2, DataLayerBit3
    access level: 0
    links:    WM::WindowStateSet - WM::WindowState, WM::WindowState - WM::WindowContent

Action Log:
00	0x63CAB476	0x7EF50001	0x33455567	0x889C537A

Command Log:
0	
2023/01/20 16:34:12
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

1	
2023/01/20 16:34:11
	
DrawingLinkStatusCheckerDo2Command

2	
2023/01/20 16:34:11
	
UtilityFunctionSet_Misc_ExecuteAPIFunction_LeaveEditing_Command

3	
2023/01/20 16:34:10
	
DraftingGroupExtensionNewGenericPlanCommand

4	
2023/01/20 16:34:08
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

5	
2023/01/20 16:33:40
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

6	
2023/01/20 16:33:40
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

7	
2023/01/20 16:33:40
	
DrawingLinkStatusCheckerDo2Command

8	
2023/01/20 16:33:39
	
GoToStoryInActWindowCommand

9	
2023/01/20 16:33:39
	
PNOpenViewCommandClass

10	
2023/01/20 16:33:39
	
StorePlanWindowViewSettingDuringIESCommand

11	
2023/01/20 16:33:38
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

12	
2023/01/20 16:33:37
	
DrawingLinkStatusCheckerDo2Command

13	
2023/01/20 16:33:37
	
UtilityFunctionSet_Misc_ExecuteAPIFunction_LeaveEditing_Command

14	
2023/01/20 16:33:34
	
DraftingGroupExtensionNewGenericPlanCommand

15	
2023/01/20 16:33:27
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

16	
2023/01/20 16:33:27
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

17	
2023/01/20 16:31:48
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

18	
2023/01/20 16:31:47
	
MarkerLinkManagerMultiEventMessageDoCommand

19	
2023/01/20 16:31:47
	
ChangeManagerMultiEventMessageDoCommand

20	
2023/01/20 16:31:47
	
ScheduleSyncronizeEventHandlerDoCommand




//+=+=+=+=+=+=+=+=+ END REPORT +=+=+=+=+=+=+=+=+=+=+=+=+&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Callstack:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="crashStack.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/33617i6EB75FC05381249D/image-size/large?v=v2&amp;amp;px=999" role="button" title="crashStack.png" alt="crashStack.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2023 15:57:09 GMT</pubDate>
    <dc:creator>VxGrid</dc:creator>
    <dc:date>2023-01-20T15:57:09Z</dc:date>
    <item>
      <title>APIDb_ChangeCurrentDatabaseID crashing</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIDb-ChangeCurrentDatabaseID-crashing/m-p/368247#M1352</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am building a plugin and the following constellation keeps crashing more often than not and I don't really understand why:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Open a Solo project&lt;/LI&gt;&lt;LI&gt;Create a worksheet by right clicking on worksheets -&amp;gt; new worksheet in the Navigator&lt;/LI&gt;&lt;LI&gt;Run the plugin from the menu&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;In the plugin it crashes when I try to switch to the database of the Floorplan, or if I call APIDo_ChangeWindowID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;API_DatabaseInfo    origDB, planDB;
BNZeroMemory(&amp;amp;planDB, sizeof(API_DatabaseInfo));
planDB.typeID = APIWind_FloorPlanID;
ACAPI_Database(APIDb_GetCurrentDatabaseID, &amp;amp;origDB, nullptr);
// next line will crash
ACAPI_Database(APIDb_ChangeCurrentDatabaseID, &amp;amp;planDB, nullptr);

// using this instead will crash as well:
API_WindowInfo windInfo = {};
windInfo.typeID = APIWind_FloorPlanID;
ACAPI_Automate(APIDo_ChangeWindowID, &amp;amp;windInfo);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is happening in AC25 on windows 10, running in release with debug info.&lt;/P&gt;&lt;P&gt;The strange thing is that it sometimes does not crash, for example if there are elements in the floorplan database like sections.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Crash report:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;//================= BEGIN REPORT ======================

Computer-name: DESKTOP-D4LEQVE
User-name    : suppo
Account name : suppo
Domain name  : DESKTOP-D4LEQVE

Computer-name: d7975a9c6ccca512f607154d6ac02d2fb14e1f2c9ce2b0c9d7f993dd9ff7d368
User-name    : c49a59749971193cba65fe48ec9d59dd5fce536c41ce841b834bec87821db22f
Account name : c49a59749971193cba65fe48ec9d59dd5fce536c41ce841b834bec87821db22f
Domain name  : d7975a9c6ccca512f607154d6ac02d2fb14e1f2c9ce2b0c9d7f993dd9ff7d368

Program Version: 25.0.0 R1 (4013)
 (64-bit)

Package Version: v2021 FULL INT 4013
Command Line: &amp;lt;"C:\Program Files\Graphisoft\ARCHICAD 25 INT\ARCHICAD.exe" -DEMO&amp;gt;
Process ID  : 17048
Thread  ID  : 16216 
GL_VENDOR: NVIDIA Corporation
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: NVIDIA GeForce RTX 2060/PCIe/SSE2
GL_RENDERER: NVIDIA GeForce RTX 2060/PCIe/SSE2
GL_VERSION: 4.6.0 NVIDIA 516.94
GL_VERSION: 4.6.0 NVIDIA 516.94
LicenseData: DemoMode
LicenseData: DemoMode
LicenseDataEDS: DemoMode
LicenseDataEDS: DemoMode
ProjectName: Untitled
ProjectName: 094b7511d1feca678ff65f27355f9d3f9dda59290a30c6e4f72cfc0c99cc9529
ProjectFileName-ProjectOpeningProcess: ARCHICAD 25 Template.tpl
ProjectFileName-ProjectOpeningProcess: 3d9be14fc328a5d6c6d0f05fb37b9e3ebf5a5323cdbc7a1dca7811d82d270aea
OS Version  : Windows WorkStation (10.0) 10.0.19045 (64-bit) 

Session start: 2023/01/20 15:31:01
System time: 2023/01/20 15:34:14

ODB assertion failed at P:\VMWD\Build\Sources\ObjectDatabase\ObjectDatabaseDll\Database\ODBDatabase.cpp 2463
    assert id: 8050C8D9-04C5-41A6-A9E2-90F0D4C95482
    description: database modification is not allowed for the current thread
    class:    WM::WindowState
    id:       36CC92C4-C8B6-443E-9136-8575E02A924E
    idSpace:  ACP::UserProject
    database: ACP::UserProject
    flags:    Internal, WasInternalFlag, Loadable, HadInternalLinksFlag, HasOwnerObjectFlag, ObjectModifiedOnTraceLine1, ObjectModifiedOnTraceLine3, LinkModifiedOnTraceLine1, Pinned, ModifiableWithoutModificationScope, DataLayerBit1, DataLayerBit2, DataLayerBit3
    access level: 0
    links:    WM::WindowStateSet - WM::WindowState, WM::WindowState - WM::WindowContent

Action Log:
00	0x63CAB476	0x7EF50001	0x33455567	0x889C537A

Command Log:
0	
2023/01/20 16:34:12
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

1	
2023/01/20 16:34:11
	
DrawingLinkStatusCheckerDo2Command

2	
2023/01/20 16:34:11
	
UtilityFunctionSet_Misc_ExecuteAPIFunction_LeaveEditing_Command

3	
2023/01/20 16:34:10
	
DraftingGroupExtensionNewGenericPlanCommand

4	
2023/01/20 16:34:08
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

5	
2023/01/20 16:33:40
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

6	
2023/01/20 16:33:40
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

7	
2023/01/20 16:33:40
	
DrawingLinkStatusCheckerDo2Command

8	
2023/01/20 16:33:39
	
GoToStoryInActWindowCommand

9	
2023/01/20 16:33:39
	
PNOpenViewCommandClass

10	
2023/01/20 16:33:39
	
StorePlanWindowViewSettingDuringIESCommand

11	
2023/01/20 16:33:38
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

12	
2023/01/20 16:33:37
	
DrawingLinkStatusCheckerDo2Command

13	
2023/01/20 16:33:37
	
UtilityFunctionSet_Misc_ExecuteAPIFunction_LeaveEditing_Command

14	
2023/01/20 16:33:34
	
DraftingGroupExtensionNewGenericPlanCommand

15	
2023/01/20 16:33:27
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

16	
2023/01/20 16:33:27
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

17	
2023/01/20 16:31:48
	
DrawingsAutoUpdaterDoAutoUpdateDrawings2Command

18	
2023/01/20 16:31:47
	
MarkerLinkManagerMultiEventMessageDoCommand

19	
2023/01/20 16:31:47
	
ChangeManagerMultiEventMessageDoCommand

20	
2023/01/20 16:31:47
	
ScheduleSyncronizeEventHandlerDoCommand




//+=+=+=+=+=+=+=+=+ END REPORT +=+=+=+=+=+=+=+=+=+=+=+=+&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Callstack:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="crashStack.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/33617i6EB75FC05381249D/image-size/large?v=v2&amp;amp;px=999" role="button" title="crashStack.png" alt="crashStack.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 15:57:09 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIDb-ChangeCurrentDatabaseID-crashing/m-p/368247#M1352</guid>
      <dc:creator>VxGrid</dc:creator>
      <dc:date>2023-01-20T15:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: APIDb_ChangeCurrentDatabaseID crashing</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIDb-ChangeCurrentDatabaseID-crashing/m-p/368511#M1353</link>
      <description>&lt;P&gt;Thinking about it a little bit longer.&lt;/P&gt;&lt;P&gt;I guess this happens when you call these functions outside of the main thread, so I'll retry with&lt;/P&gt;&lt;PRE&gt;ACAPI_Command_CallFromEventLoop&lt;/PRE&gt;&lt;P&gt;but I think this should resolve nicely&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 08:05:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIDb-ChangeCurrentDatabaseID-crashing/m-p/368511#M1353</guid>
      <dc:creator>VxGrid</dc:creator>
      <dc:date>2023-01-23T08:05:31Z</dc:date>
    </item>
  </channel>
</rss>

