OpenGL memory hosed?

Hey all,

I’m trying to load another application into the Blender (2.80) process and it all seems to go fine until the loading completes. It all is fine as the application loading completes fine, but then Blender itself crashes in GUI drawing. The callstack I get is:

|>|blender.exe!immAttr2f(unsigned int attr_id, float x=1514.00000, float y=25.0000000) Line 442|C|
| |blender.exe!immVertex2f(unsigned int attr_id, float x, float y) Line 651|C|
| |blender.exe!region_draw_emboss(const ARegion * ar, const rcti * scirct, int sides=9) Line 112|C|
| |blender.exe!ED_region_do_draw(bContext * C=0x000001ed116722d8, ARegion * ar=0x000001ed29c9bbd8) Line 549|C|
| |blender.exe!wm_draw_window_offscreen(bContext * C=0x000001ed116722d8, wmWindow * win=0x000001ed18abe1a8, bool stereo) Line 574|C|
| |blender.exe!wm_draw_window(bContext * C=0x000001ed116722d8, wmWindow * win=0x000001ed18abe1a8) Line 708|C|
| |blender.exe!wm_draw_update(bContext * C=0x000001ed116722d8) Line 865|C|
| |blender.exe!WM_main(bContext * C=0x000001ed116722d8) Line 425|C|
| |blender.exe!main(int argc=1, const unsigned char * * UNUSED_argv_c=0x0000000000000000) Line 507|C|
| |[Inline Frame] blender.exe!invoke_main() Line 78|C++|
| |blender.exe!__scrt_common_main_seh() Line 288|C++|
| |kernel32.dll!BaseThreadInitThunk()|Unknown|
| |ntdll.dll!RtlUserThreadStart()|Unknown|

The code that this crashes at is in function

void immAttr2f(uint attr_id, float x, float y)
{
	GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
	assert(attr_id < imm.vertex_format.attr_len);
	assert(attr->comp_type == GPU_COMP_F32);
	assert(attr->comp_len == 2);
	assert(imm.vertex_idx < imm.vertex_len);
	assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
	setAttrValueBit(attr_id);

	float *data = (float *)(imm.vertex_data + attr->offset);
/*	printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm.buffer_data, data); */

	data[0] = x; // <<<<----- CRASH HAPPENS HERE
	data[1] = y;
}

Does anyone have an idea what to look at why this could be happening? I was thinking myself that perhaps the memory used for OpenGL gets somehow hosed, but not sure where to start looking.

FWIW I am able to load the application in CPython 3.7 command-line interpreter and access the object without problems.

Is the other application also doing OpenGL drawing? If so it might interfere with the Blender OpenGL context.

Thanks, I’ll try figure this out.

As far as I know I try to load it without UI, but maybe it still tries to create its own contexts.