1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-09-30 10:17:23 +02:00

NULL checks for processVsync

This commit is contained in:
Ethan Lee 2020-07-01 00:36:04 -04:00
parent ffe425a202
commit 708c8be089

View file

@ -3279,11 +3279,21 @@ void Graphics::processVsync()
SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, vsync ? "1" : "0", SDL_HINT_OVERRIDE); SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, vsync ? "1" : "0", SDL_HINT_OVERRIDE);
// FIXME: Sigh... work around SDL2 bug where the VSync hint is only listened to at renderer creation // FIXME: Sigh... work around SDL2 bug where the VSync hint is only listened to at renderer creation
if (screenbuffer == NULL)
{
return;
}
if (screenbuffer->m_renderer != NULL)
{
SDL_DestroyRenderer(screenbuffer->m_renderer); SDL_DestroyRenderer(screenbuffer->m_renderer);
}
screenbuffer->m_renderer = SDL_CreateRenderer(screenbuffer->m_window, -1, 0); screenbuffer->m_renderer = SDL_CreateRenderer(screenbuffer->m_window, -1, 0);
// Ugh, have to re-create m_screenTexture as well, otherwise the screen will be black... // Ugh, have to re-create m_screenTexture as well, otherwise the screen will be black...
if (screenbuffer->m_screenTexture != NULL)
{
SDL_DestroyTexture(screenbuffer->m_screenTexture); SDL_DestroyTexture(screenbuffer->m_screenTexture);
}
// FIXME: This is duplicated from Screen::init()! // FIXME: This is duplicated from Screen::init()!
screenbuffer->m_screenTexture = SDL_CreateTexture( screenbuffer->m_screenTexture = SDL_CreateTexture(
screenbuffer->m_renderer, screenbuffer->m_renderer,