Find the next step in your career as a Graphisoft Certified BIM Manager!

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

APIDb_ChangeCurrentDatabaseID crashing

VxGrid
Participant

Hi,

 

I am building a plugin and the following constellation keeps crashing more often than not and I don't really understand why:

 

  1. Open a Solo project
  2. Create a worksheet by right clicking on worksheets -> new worksheet in the Navigator
  3. Run the plugin from the menu

In the plugin it crashes when I try to switch to the database of the Floorplan, or if I call APIDo_ChangeWindowID

 

 

API_DatabaseInfo    origDB, planDB;
BNZeroMemory(&planDB, sizeof(API_DatabaseInfo));
planDB.typeID = APIWind_FloorPlanID;
ACAPI_Database(APIDb_GetCurrentDatabaseID, &origDB, nullptr);
// next line will crash
ACAPI_Database(APIDb_ChangeCurrentDatabaseID, &planDB, nullptr);

// using this instead will crash as well:
API_WindowInfo windInfo = {};
windInfo.typeID = APIWind_FloorPlanID;
ACAPI_Automate(APIDo_ChangeWindowID, &windInfo);

 

 

This is happening in AC25 on windows 10, running in release with debug info.

The strange thing is that it sometimes does not crash, for example if there are elements in the floorplan database like sections.

 

 

Crash report:

 

//================= 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: <"C:\Program Files\Graphisoft\ARCHICAD 25 INT\ARCHICAD.exe" -DEMO>
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 +=+=+=+=+=+=+=+=+=+=+=+=+

 

 

Callstack:

crashStack.png

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
VxGrid
Participant

Thinking about it a little bit longer.

I guess this happens when you call these functions outside of the main thread, so I'll retry with

ACAPI_Command_CallFromEventLoop

but I think this should resolve nicely

View solution in original post

1 REPLY 1
Solution
VxGrid
Participant

Thinking about it a little bit longer.

I guess this happens when you call these functions outside of the main thread, so I'll retry with

ACAPI_Command_CallFromEventLoop

but I think this should resolve nicely