Crash in draw_manager while rendering to a second window with an OpenGL draw callback

Hi folks,

I’m getting an intermittent crash when drawing using a callback to a second window. It’s maddening because it only happens on some machines, some of the time, but when it happens it’s always in the same place: draw_manager.c, line 1281:

DRWView *view = BLI_memblock_alloc(DST.vmempool->views);

I loaded a debug build of Blender into WinDBG Preview and the memory for vmempool as well as a lot of the rest of the structure is unreadable.

Now, what I’m doing is unorthodox-- I’ve popped open a second window so I can have my draw callback render on top of regular blender, so that I can capture it as a screenshot to build a preview video. (I asked on blender.chat and was told that there’s no API to allow for callbacks to draw during a hardware render, and that one won’t be coming soon.) But like I said above, only some users get hit by this issue some of the time. My home machine never sees it. Half of the machines used my by team at work see it. I’ve also checked drivers and it doesn’t seem related to driver versions.

My thought is that this has something to do with threading, and that the thread doing this drawing isn’t able to access the memory from the pool?

Any help would be appreciated, even if you could point me in the direction of how to debug where this is failing.

Thanks!!

draw_manager_issue|548x500

Image didn’t come through; attaching again