Our game crashes on certain occasions with varying probability (about 50-75% of all cases on affected systems). We collected data from more than 20 test participants – all affected systems run Windows 10, no crashes under Windows 7.

Description: All crashes occur while removing locally created panels. Some of these panels consist of one or more panel elements created at runtime, others have no special elements assigned (see examples below). Crash reproduction failed in dev version; it can only be reproduced in the published version.

We are using a lot of both globally and locally created objects (panels, entities, texts, strings) in our code and so far only removal of local panels seems to lead to crashes.

Could you please give us a hint on how can we debug and fix this? What happens internally during the removal of (local) panels? Does 3DGS support have suitable tools or better ways to analyze these crashes in the published version more precisely?

On a side-note, we have already tried analyzing panel objects using sys_markers and found out that these instructions – unlike others we checked – don’t carry a control byte. How are these handled internally? Do panels allocate memory using sys_malloc? How/where are panels and panel elements stored internally?

Examples

1. Simple fadescreen
Click to reveal..
Code:
// Simple: We create a fullscreen, plain color panel as fade screen during a cutscene. 
// Game crashes [sometimes] after cutscene finished and fadescreen panel is removed.
function intro_sequence()
{
	// ...

	PANEL* _pan_fadescreen = pan_create("red=0; green=0; blue=25; alpha = 100; flags = SHOW | LIGHT | TRANSLUCENT | UNTOUCHABLE;",89);
	_pan_fadescreen.size_x=1920;
	_pan_fadescreen.size_y=1080;
	_pan_fadescreen.scale_x=screen_size.x/1920;
	_pan_fadescreen.scale_y=screen_size.y/1080;

	// ...
	
	while(SEQUENCE_RUNNING)
	{
		if(SCENE==FIRST_SCENE)
		{
			// ...
			_pan_fadescreen.alpha-=10*time_step;
			_pan_fadescreen.alpha=clamp(_pan_fadescreen_alpha,0,100);
			// ...
		}
	
		// ...
		
		if(SCENE==LAST_SCENE)
		{
			// ...
			_pan_fadescreen.alpha+=10*time_step;
			_pan_fadescreen.alpha=clamp(_pan_fadescreen_alpha,0,100);
			// ...
		}
	
		// ...
	
		wait(1);
	}

	// ...
	diag("n Removing panel..."); 	// this is the final line in acklog.txt
	ptr_remove(_pan_fadescreen);
	_pan_fadescreen=NULL;
	diag("OK!"); 	// does not appear in acklog
	// ...
}




2. „Abort Cutscene“ panel
Click to reveal..
Code:
// This one is a bit more complex and also uses additional panel elements instructions, like
// pan_setstring and pan_setcolor. 
// Game crashes [sometimes] after cutscene finished/has been cancelled and message panel is removed.
function cancel_cutscene_message()
{
	// create panel
	PANEL* _pan_skip = pan_create("alpha = 0; flags = ARIGHT | SHOW | TRANSLUCENT | FILTER | SHADOW;",9999);
	_pan_skip.scale_x = screen_size.x/1920;
	_pan_skip.scale_y = screen_size.y/1080;
	
	// create panel elements
	temp=pan_setstring(_pan_skip,0,1900,20,fnt_button_tiny,label_mm_skip);
	pan_setcolor(_pan_skip,1,temp,FONT_COLOR_MM_SKIP);
	
	// fnt_button_tiny: truetype font
	// label_mm_skip: unicode (!) string contained in global text object
	// FONT_COLOR_MM_SKIP: globally defined vector
	
	while(cutscene_active)
	{
		// ...
		// ...
		// wait for end of cutscene or player input
		// ...
		// ...
		
		wait(1);
	}
	
	diag("removing panel..."); 	// this is the final line in acklog.txt
	ptr_remove(_pan_skip);
	diag("OK");	// does not appear in acklog
}