Strange crash, any idea?

Hi, my game usually crashes when i try to create a new sdl_window
after one is destroyed
the crash is at sdl_video.c in SDL_OnWindowFocusLost(), at this point

if (display->gamma && _this->SetDisplayGammaRamp) {
_this->SetDisplayGammaRamp(_this, display, display->saved_gamma);

display pointer is not nil so it crashes when accessing the gamma value.
any idea why? what is this piece of code for?