mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-23 20:12:39 +03:00
#4768 Fixed race condition on active client proxy switch
This commit is contained in:
parent
1a76acd446
commit
30fa5223bc
@ -496,6 +496,18 @@ Server::switchScreen(BaseClientProxy* dst,
|
||||
}
|
||||
}
|
||||
|
||||
// if already sending clipboard, we need to interupt it, otherwise
|
||||
// clipboard data could be corrupted on the other side
|
||||
// interrupt before switch active, as send clipboard uses active
|
||||
// client proxy, which would cause race condition
|
||||
if (m_sendClipboardThread != NULL) {
|
||||
StreamChunker::setClipboardInterrupt(true);
|
||||
m_sendClipboardThread->wait();
|
||||
delete m_sendClipboardThread;
|
||||
m_sendClipboardThread = NULL;
|
||||
StreamChunker::setClipboardInterrupt(false);
|
||||
}
|
||||
|
||||
// cut over
|
||||
m_active = dst;
|
||||
|
||||
@ -506,15 +518,6 @@ Server::switchScreen(BaseClientProxy* dst,
|
||||
m_active->enter(x, y, m_seqNum,
|
||||
m_primaryClient->getToggleMask(),
|
||||
forScreensaver);
|
||||
// if already sending clipboard, we need to interupt it, otherwise
|
||||
// clipboard data could be corrupted on the other side
|
||||
if (m_sendClipboardThread != NULL) {
|
||||
StreamChunker::setClipboardInterrupt(true);
|
||||
m_sendClipboardThread->wait();
|
||||
delete m_sendClipboardThread;
|
||||
m_sendClipboardThread = NULL;
|
||||
StreamChunker::setClipboardInterrupt(false);
|
||||
}
|
||||
|
||||
// send the clipboard data to new active screen
|
||||
m_sendClipboardThread = new Thread(
|
||||
|
Loading…
Reference in New Issue
Block a user