Fix rare race condition in overlay update code
This commit is contained in:
parent
114074bfd8
commit
e20d56041e
5 changed files with 15 additions and 10 deletions
|
|
@ -181,7 +181,8 @@ void SLVideoDecoder::notifyOverlayUpdated(Overlay::OverlayType type)
|
|||
}
|
||||
|
||||
SDL_Surface* newSurface = Session::get()->getOverlayManager().getUpdatedOverlaySurface(type);
|
||||
if (newSurface == nullptr && Session::get()->getOverlayManager().isOverlayEnabled(type)) {
|
||||
bool overlayEnabled = Session::get()->getOverlayManager().isOverlayEnabled(type);
|
||||
if (newSurface == nullptr && overlayEnabled) {
|
||||
// There's no updated surface and the overlay is enabled, so just leave the old surface alone.
|
||||
return;
|
||||
}
|
||||
|
|
@ -193,7 +194,7 @@ void SLVideoDecoder::notifyOverlayUpdated(Overlay::OverlayType type)
|
|||
m_Overlay = nullptr;
|
||||
}
|
||||
|
||||
if (!Session::get()->getOverlayManager().isOverlayEnabled(type)) {
|
||||
if (!overlayEnabled) {
|
||||
SDL_FreeSurface(newSurface);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue