mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-08 16:56:03 +00:00
Fix handling close(0) in our DRM master hooks
Prior to this fix, we would become out of sync and fail to promote Qt and SDL FDs to master when required, causing Qt's mouse to disappear and the SDL video subsystem to fail initialization when trying to stream.
This commit is contained in:
@@ -34,7 +34,7 @@ extern struct stat g_DrmMasterStat;
|
||||
extern bool g_DisableDrmHooks;
|
||||
|
||||
#define MAX_SDL_FD_COUNT 8
|
||||
int g_SdlDrmMasterFds[MAX_SDL_FD_COUNT];
|
||||
int g_SdlDrmMasterFds[MAX_SDL_FD_COUNT] = {-1, -1, -1, -1, -1, -1, -1, -1};
|
||||
int g_SdlDrmMasterFdCount = 0;
|
||||
pthread_mutex_t g_FdTableLock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
@@ -58,6 +58,13 @@ int getSdlFdEntryIndex(bool unused)
|
||||
// Returns true if the final SDL FD was removed
|
||||
bool removeSdlFd(int fd)
|
||||
{
|
||||
// -1 will break our logic below that looks for matches
|
||||
// in the entire array (which we must do because it may
|
||||
// not be contiguously populated).
|
||||
if (fd == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_FdTableLock);
|
||||
if (g_SdlDrmMasterFdCount != 0) {
|
||||
// Clear the entry for this fd from the table
|
||||
|
||||
Reference in New Issue
Block a user