"Unable to make GL context current" on every redraw

I’m in the process of adapting a large project that previous drew to the VESA framebuffer to use SDL. SDL renders the initial framebuffer correctly, but all subsequent attempts to refresh the screen with SDL_UpdateWindowSurface or SDL_UpdateWindowSurfaceRects fail. The error returned is -1, and SDL_GetError gives me “Unable to make GL context current”. This is odd, because I am not even using GL in any way, at least that I know of.

I’m using SDL 2.0.20+dfsg on Ubuntu 22.04, if that matters.

What’s going on here?

Looks like this might be due to threading issues. My application is highly multi-threaded. I moved things around so that SDL init and all SDL calls happen on the same thread, but no change in behavior yet.