mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Fix uninitialized variables and a race condition with CVDisplayLinkStart()
This commit is contained in:
@@ -23,7 +23,9 @@ public:
|
|||||||
m_DisplayLayer(nullptr),
|
m_DisplayLayer(nullptr),
|
||||||
m_FormatDesc(nullptr),
|
m_FormatDesc(nullptr),
|
||||||
m_StreamView(nullptr),
|
m_StreamView(nullptr),
|
||||||
m_DisplayLink(nullptr)
|
m_DisplayLink(nullptr),
|
||||||
|
m_VsyncMutex(nullptr),
|
||||||
|
m_VsyncPassed(nullptr)
|
||||||
{
|
{
|
||||||
SDL_zero(m_OverlayTextFields);
|
SDL_zero(m_OverlayTextFields);
|
||||||
}
|
}
|
||||||
@@ -118,6 +120,11 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The CVDisplayLink callback uses these, so we must initialize them before
|
||||||
|
// starting the callbacks.
|
||||||
|
m_VsyncMutex = SDL_CreateMutex();
|
||||||
|
m_VsyncPassed = SDL_CreateCond();
|
||||||
|
|
||||||
status = CVDisplayLinkStart(m_DisplayLink);
|
status = CVDisplayLinkStart(m_DisplayLink);
|
||||||
if (status != kCVReturnSuccess) {
|
if (status != kCVReturnSuccess) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
@@ -126,9 +133,6 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_VsyncMutex = SDL_CreateMutex();
|
|
||||||
m_VsyncPassed = SDL_CreateCond();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user