[CONNECT C++] Cannot get mdlDialog_buttonGroupInsSubItem() to work

When I attempt to insert a button into a ButtonGroup using mdlDialog_buttonGroupInsSubItem(), MicroStation crashes. I can use mdlDialog_buttonGrouGetSubInfo(), mdlDialog_buttonGroupSetSubInfo(),  and mdlDialog_buttonGroupDeleteItem() just fine. My ButtonGroup is defined such:

DItem_ButtonGroupRsc BUTTONGROUPID_Arch_Doors = 
{ 
	NOSYNONYM, NOHELP, MHELP, ITEMHOOKID_ButtonGroup, NOARG, 
	0, 6, 3, 0, 0, -1 /*WHITE_INDEX*/, "", "srsDialogInfo.comboBoxChoice", 
  {		//IconType, IconID, commandNumber, commandSource, value, mask, arrayIndex, attributes, label 
		{RTYPE_Icon, ICONDID_1,  NOCMD, LCMD,   1, NOMASK, 0, 0, "3 x 7 Door"},			//	 "DOOR"
	}
};

In the _OnInit() hook, I'm querying the single "button" item to fill in the values for the new button I want to insert. To try and eliminate any "conflicts" I delete that button and then insert attempt to insert the "new" one. I can query the existing button and remove it without issue - when the code executes mdlDialog_buttonGroupInsSubItem(), it causes MicroStation to crash. If I do not remove the original button in the group, the code still crashes.

bool	MyButtonGroupHandler::_OnInit(DialogItemInitArgsR init)
{
	UInt32				value = 1;
	UInt32				mask = NOMASK;
	UInt32				arrayIndex = 0;
	UInt32				attributes = 0;
	RscType				rscType = RTYPE_Icon;
	RscId				rscId = ICONDID_1;
	int					cmdSource = LCMD;
	IconRsc				*pIcon = NULL;
	//WCharP				pLabel = NULL;
	WChar				Label[256];
	CommandNumber		cmdNumber;
	UInt32				index = 0;
	mdlDialog_buttonGroupGetSubInfo(Label, &rscType, &rscId, &pIcon, &cmdNumber, &cmdSource, &value, &mask, &arrayIndex, &attributes, NULL, GetRawItem(), index);
	mdlDialog_buttonGroupDeleteItem(GetRawItem(),index);
    // crashes if I include this line
    WCharCP				newLabel=L"NewLabel";
    mdlDialog_buttonGroupInsSubItem(newLabel, &rscType, &rscId, &cmdNumber, &cmdSource, &value, &mask, &arrayIndex, &attributes, NULL, GetRawItem(), -1, true);	// fails
	return true;
}

The crash report contains this;

Exception String: 'Access Violation'

Wrote a mini-dump type 0x4 to "c:\Temp\1\Bentley\MicroStation\10.0.0\MiniDump.dmp".
Stack dump:
Exception: 0xc0000005 @ 0x14bb2668
0: 0000004068ffca80 00007ff814bb23bf 0000000000000008 0000000000000008 0000000000000000 0000000000000010 RtlReAllocateHeap+0x408
1: 0000004068ffcbe0 00007ff814bb22ba 000001d69ac695a0 0000000000000008 0000004068ffcf20 000001d6b32ddd30 RtlReAllocateHeap+0x15f
2: 0000004068ffcc20 00007ff810fb2bf9 0000000000000128 000001d6b32ddd30 00000000533ed530 0000004068ffcd30 RtlReAllocateHeap+0x5a
3: 0000004068ffcc50 00007fffe06cc570 0000000000000128 00007ff810fae88b 00000000ffffffff 000001d6b32ddd30 realloc_base+0x39
4: 0000004068ffccc0 0000000052bdcfd4 000001d6b3077a20 00000000533ed530 0000000000000000 0000000000000000 memutil_realloc+0x20
5: 0000004068ffccf0 00000000529e1bb4 000001d6b32ddd30 00000000ffffffff 000001d69ae7fd10 0000000000000058 dlmSystem_mdlReallocWithDescr+0xf4
6: 0000004068ffcd90 00000000529e3a70 000001d6b32ddd30 ffffffffffffffff 00007fffc8b0ab28 00007fffc8b0ab28 basicText_undoField+0x1324
7: 0000004068ffce00 00000000529e387f 0000004068ffcf90 0000000000000000 000001d69ba4adf0 00000000529e1190 mdlDialog_buttonGroupInsSubItemDesc+0x1e0
8: 0000004068ffce80 00007fffc8b040c9 00007fffc8b0aa00 0000004068ffcf30 0000000049636f6e 0000000049636f6e mdlDialog_buttonGroupInsSubItem+0x7f

Bruce

Parents
  • Hi Bruce,

    Could you zip and post the exception.log and minidump.dmp file from your exception in this thread?

    c:\Temp\1\Bentley\MicroStation\10.0.0\MiniDump.dmp

    Also, if you have a simplified stand-alone "test case" having the minimal items necessary to reproduce the crash and are able to zip and attach to this post I can also review it.

    Thank you,
    Bob



Reply
  • Hi Bruce,

    Could you zip and post the exception.log and minidump.dmp file from your exception in this thread?

    c:\Temp\1\Bentley\MicroStation\10.0.0\MiniDump.dmp

    Also, if you have a simplified stand-alone "test case" having the minimal items necessary to reproduce the crash and are able to zip and attach to this post I can also review it.

    Thank you,
    Bob



Children