terminal: Fix crash due to race condition in init
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 <bdb14cfc1ab8d24e13de84adc40b41ae60c13bd1@osg.samsung.com>
Reviewed-by: Yong Bakos <d0d6c2a9047d8c98cd8ce1e9b46eb851dcd10a82@humanoriented.com>

sir-murray/weston,sir-murray/weston