[PATCH weston] input: Don't use uninitialized variables in default_grab_pointer_focus()
derekf at osg.samsung.com
Wed Apr 8 13:18:41 PDT 2015
If we have no pointer focus and weston_compositor_pick_view() returns NULL
default_grab_pointer_focus() will test the unset sx, sy output parameters
Instead, assume that since both pointers are NULL focus hasn't changed and
we don't need to update pointer focus.
Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
This fixes an error reported by valgrind. I think the patch is correct but
it does stop pointer->focus_signal from being emitted when focus switches
from NULL to NULL. I think that shouldn't have happened anyway?
Initializing sx, sy to wl_fixed_from_int(0) would silence the warning too,
but I think this way is more correct...
src/input.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/input.c b/src/input.c
index 142c670..18d1262 100644
@@ -157,6 +157,9 @@ default_grab_pointer_focus(struct weston_pointer_grab *grab)
+ if (!pointer->focus && !view)
if (pointer->focus != view || pointer->sx != sx || pointer->sy != sy)
weston_pointer_set_focus(pointer, view, sx, sy);
More information about the wayland-devel