#4740 Moved clipboard transfering back into main thread on server

This commit is contained in:
XinyuHou 2016-09-01 11:51:12 +01:00 committed by Andrew Nelless
parent 4ad2c6b10d
commit e32402b5c6
2 changed files with 5 additions and 35 deletions

View File

@ -93,8 +93,7 @@ Server::Server(
m_ignoreFileTransfer(false), m_ignoreFileTransfer(false),
m_enableDragDrop(enableDragDrop), m_enableDragDrop(enableDragDrop),
m_sendDragInfoThread(NULL), m_sendDragInfoThread(NULL),
m_waitDragInfoThread(true), m_waitDragInfoThread(true)
m_sendClipboardThread(NULL)
{ {
// must have a primary client and it must have a canonical name // must have a primary client and it must have a canonical name
assert(m_primaryClient != NULL); assert(m_primaryClient != NULL);
@ -496,18 +495,6 @@ 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 // cut over
m_active = dst; m_active = dst;
@ -520,11 +507,9 @@ Server::switchScreen(BaseClientProxy* dst,
forScreensaver); forScreensaver);
// send the clipboard data to new active screen // send the clipboard data to new active screen
m_sendClipboardThread = new Thread( for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
new TMethodJob<Server>( m_active->setClipboard(id, &m_clipboards[id].m_clipboard);
this, }
&Server::sendClipboardThread,
NULL));
Server::SwitchToScreenInfo* info = Server::SwitchToScreenInfo* info =
Server::SwitchToScreenInfo::alloc(m_active->getName()); Server::SwitchToScreenInfo::alloc(m_active->getName());
@ -1864,16 +1849,6 @@ Server::sendDragInfo(BaseClientProxy* newScreen)
} }
} }
void
Server::sendClipboardThread(void*)
{
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
m_active->setClipboard(id, &m_clipboards[id].m_clipboard);
}
m_sendClipboardThread = NULL;
}
void void
Server::onMouseMoveSecondary(SInt32 dx, SInt32 dy) Server::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
{ {

View File

@ -367,9 +367,6 @@ private:
// send drag info to new client screen // send drag info to new client screen
void sendDragInfo(BaseClientProxy* newScreen); void sendDragInfo(BaseClientProxy* newScreen);
// thread funciton for sending clipboard
void sendClipboardThread(void*);
public: public:
bool m_mock; bool m_mock;
@ -481,6 +478,4 @@ private:
bool m_waitDragInfoThread; bool m_waitDragInfoThread;
ClientListener* m_clientListener; ClientListener* m_clientListener;
Thread* m_sendClipboardThread;
}; };