mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 23:35:55 +00:00
Fix rare race condition in overlay update code
This commit is contained in:
parent
114074bfd8
commit
e20d56041e
@ -715,7 +715,8 @@ void D3D11VARenderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
||||
HRESULT hr;
|
||||
|
||||
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) {
|
||||
// The overlay is enabled and there is no new surface. Leave the old texture alone.
|
||||
return;
|
||||
}
|
||||
@ -736,7 +737,7 @@ void D3D11VARenderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
||||
SAFE_COM_RELEASE(oldVertexBuffer);
|
||||
|
||||
// If the overlay is disabled, we're done
|
||||
if (!Session::get()->getOverlayManager().isOverlayEnabled(type)) {
|
||||
if (!overlayEnabled) {
|
||||
SDL_FreeSurface(newSurface);
|
||||
return;
|
||||
}
|
||||
|
@ -844,7 +844,8 @@ void DXVA2Renderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
||||
HRESULT hr;
|
||||
|
||||
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) {
|
||||
// The overlay is enabled and there is no new surface. Leave the old texture alone.
|
||||
return;
|
||||
}
|
||||
@ -861,7 +862,7 @@ void DXVA2Renderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
||||
SAFE_COM_RELEASE(oldVertexBuffer);
|
||||
|
||||
// If the overlay is disabled, we're done
|
||||
if (!Session::get()->getOverlayManager().isOverlayEnabled(type)) {
|
||||
if (!overlayEnabled) {
|
||||
SDL_FreeSurface(newSurface);
|
||||
return;
|
||||
}
|
||||
|
@ -566,7 +566,8 @@ void VAAPIRenderer::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;
|
||||
}
|
||||
@ -599,7 +600,7 @@ void VAAPIRenderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
||||
}
|
||||
}
|
||||
|
||||
if (!Session::get()->getOverlayManager().isOverlayEnabled(type)) {
|
||||
if (!overlayEnabled) {
|
||||
SDL_FreeSurface(newSurface);
|
||||
return;
|
||||
}
|
||||
|
@ -333,7 +333,8 @@ void VDPAURenderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
||||
VdpStatus status;
|
||||
|
||||
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;
|
||||
}
|
||||
@ -358,7 +359,7 @@ void VDPAURenderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
||||
}
|
||||
}
|
||||
|
||||
if (!Session::get()->getOverlayManager().isOverlayEnabled(type)) {
|
||||
if (!overlayEnabled) {
|
||||
SDL_FreeSurface(newSurface);
|
||||
return;
|
||||
}
|
||||
|
@ -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…
x
Reference in New Issue
Block a user