summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce Harrington <bryce@osg.samsung.com>2016-08-29 16:28:08 -0700
committerQuentin Glidic <sardemff7+git@sardemff7.net>2016-09-01 00:52:10 +0200
commit5c611d933f60f720db98331c9c1c6ed4420f9782 (patch)
treeac4f42b5e35d1c50ddc20a90ee84970558ae0928
parentc6ae8126e1d0b83b76b272f02ef7a4319336c116 (diff)
downloadweston-5c611d933f60f720db98331c9c1c6ed4420f9782.tar.gz
terminal: Fix crash due to race condition in init
weston-terminal intermittently crashes on startup. This occurs because some parameters in the weston_terminal structure such as data_pitch, don't get set to non-zero until the resize_handler() callback gets triggered. That callback makes a call to terminal_resize_cells(), to calculate the proper values for these parameters. On occasion, the resize handler call is slow to resolve, and the program proceeds to start processing characters for the terminal window. With the parameters defaulting to zero, certain calculations come out wrong, leading the program to attempt to scroll the buffer when it shouldn't, and thus follows the crash. Instead, force the call to terminal_resize_cells() during the init, with some dummy defaults, to ensure the parameters are always non-zero. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=97539 Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
-rw-r--r--clients/terminal.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/clients/terminal.c b/clients/terminal.c
index 6257cb7d..34bc2c94 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -2976,6 +2976,7 @@ terminal_create(struct display *display)
cairo_surface_destroy(surface);
terminal_resize(terminal, 20, 5); /* Set minimum size first */
+ terminal_resize_cells(terminal, 20, 5);
terminal_resize(terminal, 80, 25);
wl_list_insert(terminal_list.prev, &terminal->link);