I’m using A STREAMING texture that I LOCK/Update/UNLOCK in a separate thread to the main thread.
This seems to work fine except on random Systems it causes a segmentation fault.
I have three systems (all with SDL2 2.0.8)
1 x Ubuntu 18.04
2 x Ubuntu 18.04
3 x Windows 10
The application works correctly on 1 & 3 but fails on 2.
If I copy the working app and libraries from system 1 to system 2 the app still breaks on system 2.
If I copy the broken apps and libraries from system 2 to system 1 it works fine on system 1.
Stepping through the code…
Originally : After I successfully lock the texture it faults on a call to : SDL_RenderSetClip() in the main thread! Which is called when the GUI detects a window resize.
Update : I downloaded the SDL source and compiled that with debug support and re-ran the application:
As a result the code now breaks at the actual problem location:
while(1)
{
SDL_LockTexture(t, NULL, &pixels, &pitch); // succeeds
if (pixels == NULL) fprintf(stderr, "Cannot lock texture!\n");
// UpdateEmulationWindow(pixels);
SDL_UnlockTexture(t); // Faults here but only after a window resize;
MyDelay(17); // 17msecs
}
So the problem is the UnlockTexture is failing. Not sure why this only fails during a window resize. Full screen toggling is OK but not resizing. Also this texture is not been rendered to any window. There is no RenderCopy or RenderPesent.
If I don’t lock the texture it all works fine expect but of course I can’t update the contents of the texture.
What should I look for next?
At this point I’m suspecting differences in the graphics cards!!!