mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] fix race segfault on pointer queue unsubscribe/timeout
This commit is contained in:
parent
fb4bdaee2b
commit
efa49391fc
@ -484,12 +484,23 @@ void core_handleMouseNormal(double ex, double ey)
|
||||
g_cursor.realigning = true;
|
||||
do
|
||||
{
|
||||
LG_LOCK(g_state.pointerQueueLock);
|
||||
if (!g_state.pointerQueue)
|
||||
{
|
||||
/* the queue is nolonger valid, assume complete */
|
||||
g_cursor.realigning = false;
|
||||
LG_UNLOCK(g_state.pointerQueueLock);
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t hostSerial;
|
||||
if (lgmpClientGetSerial(g_state.pointerQueue, &hostSerial) != LGMP_OK)
|
||||
{
|
||||
g_cursor.realigning = false;
|
||||
LG_UNLOCK(g_state.pointerQueueLock);
|
||||
return;
|
||||
}
|
||||
LG_UNLOCK(g_state.pointerQueueLock);
|
||||
|
||||
if (hostSerial >= setPosSerial)
|
||||
break;
|
||||
|
@ -502,8 +502,9 @@ int main_cursorThread(void * unused)
|
||||
lgSignalEvent(g_state.frameEvent);
|
||||
}
|
||||
|
||||
LG_LOCK(g_state.pointerQueueLock);
|
||||
lgmpClientUnsubscribe(&g_state.pointerQueue);
|
||||
|
||||
LG_UNLOCK(g_state.pointerQueueLock);
|
||||
|
||||
if (cursor)
|
||||
{
|
||||
@ -1484,8 +1485,12 @@ restart:
|
||||
|
||||
g_state.kvmfrFeatures = udata->features;
|
||||
|
||||
LG_LOCK_INIT(g_state.pointerQueueLock);
|
||||
if (!core_startCursorThread() || !core_startFrameThread())
|
||||
{
|
||||
LG_LOCK_FREE(g_state.pointerQueueLock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while(g_state.state == APP_STATE_RUNNING)
|
||||
{
|
||||
@ -1514,6 +1519,7 @@ restart:
|
||||
goto restart;
|
||||
}
|
||||
|
||||
LG_LOCK_FREE(g_state.pointerQueueLock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -113,6 +113,7 @@ struct AppState
|
||||
struct IVSHMEM shm;
|
||||
PLGMPClient lgmp;
|
||||
PLGMPClientQueue pointerQueue;
|
||||
LG_Lock pointerQueueLock;
|
||||
KVMFRFeatureFlags kvmfrFeatures;
|
||||
|
||||
LGThread * cursorThread;
|
||||
|
Loading…
Reference in New Issue
Block a user