Fix use-after-free caught by debug build of SDL2
This commit is contained in:
parent
eaeb9ec6f7
commit
cb5e58d465
1 changed files with 12 additions and 5 deletions
|
|
@ -228,11 +228,14 @@ bool Session::isHardwareDecodeAvailable(StreamingPreferences::VideoDecoderSelect
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
|
|
||||||
bool ret = decoder->isHardwareAccelerated();
|
bool ret = decoder->isHardwareAccelerated();
|
||||||
|
|
||||||
delete decoder;
|
delete decoder;
|
||||||
|
|
||||||
|
// This must be called after the decoder is deleted, because
|
||||||
|
// the renderer may want to interact with the window
|
||||||
|
SDL_DestroyWindow(window);
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -265,11 +268,12 @@ int Session::getDecoderCapabilities(StreamingPreferences::VideoDecoderSelection
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
|
|
||||||
int caps = decoder->getDecoderCapabilities();
|
int caps = decoder->getDecoderCapabilities();
|
||||||
|
|
||||||
delete decoder;
|
// This must be called after the decoder is deleted, because
|
||||||
|
// the renderer may want to interact with the window
|
||||||
|
SDL_DestroyWindow(window);
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
|
@ -1176,7 +1180,10 @@ DispatchDeferredCleanup:
|
||||||
m_VideoDecoder = nullptr;
|
m_VideoDecoder = nullptr;
|
||||||
SDL_AtomicUnlock(&m_DecoderLock);
|
SDL_AtomicUnlock(&m_DecoderLock);
|
||||||
|
|
||||||
|
// This must be called after the decoder is deleted, because
|
||||||
|
// the renderer may want to interact with the window
|
||||||
SDL_DestroyWindow(m_Window);
|
SDL_DestroyWindow(m_Window);
|
||||||
|
|
||||||
if (iconSurface != nullptr) {
|
if (iconSurface != nullptr) {
|
||||||
SDL_FreeSurface(iconSurface);
|
SDL_FreeSurface(iconSurface);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue