mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-09 01:06:11 +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_FormatDesc(nullptr),
|
||||
m_StreamView(nullptr),
|
||||
m_DisplayLink(nullptr)
|
||||
m_DisplayLink(nullptr),
|
||||
m_VsyncMutex(nullptr),
|
||||
m_VsyncPassed(nullptr)
|
||||
{
|
||||
SDL_zero(m_OverlayTextFields);
|
||||
}
|
||||
@@ -118,6 +120,11 @@ public:
|
||||
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);
|
||||
if (status != kCVReturnSuccess) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
@@ -126,9 +133,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
m_VsyncMutex = SDL_CreateMutex();
|
||||
m_VsyncPassed = SDL_CreateCond();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user