[PATCH weston] zoom: Check the value of level before using it.

Bryce Harrington bryce at osg.samsung.com
Tue Jan 20 18:36:32 PST 2015


On Tue, Jan 20, 2015 at 02:00:04PM -0600, Derek Foreman wrote:
> Nice catch. Zooming with mod+scrollwheel will divide by zero a few times
> at the start of zoom without this patch.
> 
> 
> Reviewed-by: Derek Foreman <derekf at osg.samsung.com>

Agreed, nice clean fix.
Pushed to trunk.

   553895e..1a873aa  master -> master

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

> On 17/01/15 01:31 PM, Carlos Olmedo Escobar wrote:
> > Check the value of level before dividing 1 by it.
> > 
> > Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e at gmail.com>
> > ---
> >  src/zoom.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/zoom.c b/src/zoom.c
> > index 7553849..f71d08c 100644
> > --- a/src/zoom.c
> > +++ b/src/zoom.c
> > @@ -120,12 +120,13 @@ weston_output_update_zoom_transform(struct weston_output *output)
> >  	float ratio, level;
> >  
> >  	level = output->zoom.spring_z.current;
> > -	ratio = 1 / level;
> >  
> >  	if (!output->zoom.active || level > output->zoom.max_level ||
> >  	    level == 0.0f)
> >  		return;
> >  
> > +	ratio = 1 / level;
> > +
> >  	if (wl_list_empty(&output->zoom.animation_xy.link))
> >  		zoom_area_center_from_pointer(output, &x, &y);
> >  
> > 
> 
> _______________________________________________
> 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