[PATCH RESEND] terminal: fix crashing when terminal size is < 0

Kristian Høgsberg krh at bitplanet.net
Mon Jan 10 11:20:59 PST 2011


On Mon, Jan 10, 2011 at 12:30 PM, Tiago Vignatti
<tiago.vignatti at nokia.com> wrote:
> Just skip drawing when width or height is less than zero.
>
> Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
> ---
> haven't tested actually whether child windows still okay.

Still crashes here with your patch, and I was thinking that it'd be
better to restict the minimum size to one character cell and then work
backwards from that to find the minimum size.

Kristian

>  clients/terminal.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/clients/terminal.c b/clients/terminal.c
> index 4bfb06b..1c7cbbf 100644
> --- a/clients/terminal.c
> +++ b/clients/terminal.c
> @@ -838,6 +838,10 @@ terminal_draw(struct terminal *terminal)
>                (int32_t) terminal->extents.max_x_advance;
>        height = (rectangle.height - 2 * terminal->margin) /
>                (int32_t) terminal->extents.height;
> +
> +       if (width < 0 || height < 0)
> +               return;
> +
>        terminal_resize(terminal, width, height);
>
>        window_draw(terminal->window);
> --
> 1.7.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>


More information about the wayland-devel mailing list