Merge pull request #26 from glyptodon/terminal-resize-segfault

GUAC-1028: Fix race condition on terminal resize.
This commit is contained in:
James Muehlner 2015-02-05 18:23:10 -08:00
commit 7b6089481c

View File

@ -1220,6 +1220,9 @@ int guac_terminal_resize(guac_terminal* terminal, int width, int height) {
guac_client* client = display->client; guac_client* client = display->client;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
/* Acquire exclusive access to terminal */
guac_terminal_lock(terminal);
/* Calculate available display area */ /* Calculate available display area */
int available_width = width - GUAC_TERMINAL_SCROLLBAR_WIDTH; int available_width = width - GUAC_TERMINAL_SCROLLBAR_WIDTH;
if (available_width < 0) if (available_width < 0)
@ -1250,6 +1253,9 @@ int guac_terminal_resize(guac_terminal* terminal, int width, int height) {
} }
/* Release terminal */
guac_terminal_unlock(terminal);
guac_terminal_notify(terminal); guac_terminal_notify(terminal);
return 0; return 0;