Skip to content

Commit 8cc6c7e

Browse files
committed
libvncserver: prevent cursor drawing during framebuffer exchange
Fixes segfaults in rfbHideCursor(), maybe elsewhere, too.
1 parent 06c8695 commit 8cc6c7e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

libvncserver/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,9 @@ void rfbNewFramebuffer(rfbScreenInfoPtr screen, char *framebuffer,
10791079
}
10801080
rfbReleaseClientIterator(iterator);
10811081

1082+
/* Prevent cursor drawing into framebuffer */
1083+
LOCK(screen->cursorMutex);
1084+
10821085
/* Update information in the screenInfo structure */
10831086

10841087
old_format = screen->serverFormat;
@@ -1136,6 +1139,9 @@ void rfbNewFramebuffer(rfbScreenInfoPtr screen, char *framebuffer,
11361139
UNLOCK(cl->sendMutex);
11371140
}
11381141
rfbReleaseClientIterator(iterator);
1142+
1143+
/* Re-enable cursor drawing into framebuffer */
1144+
UNLOCK(screen->cursorMutex);
11391145
}
11401146

11411147
/* hang up on all clients and free all reserved memory */

0 commit comments

Comments
 (0)