It seems that there is a problem happening randomly in the OSXVnc code.
In the function rfbSendRichCursorUpdate() of the file mousecursor.c a mutex is locked after getting some information on the cursor. Those information can be changed by another thread which cause the server to send wrong data to the client.
I think that it could be solved by replacing
Bool rfbSendRichCursorUpdate(rfbClientPtr cl) {
BOOL cursorIsDifferentFormat = !(PF_EQ(cursorFormat,rfbServerFormat));
BOOL returnValue = TRUE;
int cursorSize = (cursorRect.size.width * cursorRect.size.height * (cl->format.bitsPerPixel / 8));
pthread_mutex_lock(&cursorMutex);
by
Bool rfbSendRichCursorUpdate(rfbClientPtr cl) {
BOOL returnValue = TRUE;
pthread_mutex_lock(&cursorMutex);
BOOL cursorIsDifferentFormat = !(PF_EQ(cursorFormat,rfbServerFormat));
int cursorSize = (cursorRect.size.width * cursorRect.size.height * (cl->format.bitsPerPixel / 8));
I hope this will be helpful,