window.c: Fix SIGSEGV in pointer_handle_motion
Move null pointer check and assignments before first window dereference.
This commit is contained in:
committed by
Kristian Høgsberg
parent
037bdc4c5d
commit
b22bf57e21
+6
-6
@@ -2904,6 +2904,12 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
|
|||||||
float sx = wl_fixed_to_double(sx_w);
|
float sx = wl_fixed_to_double(sx_w);
|
||||||
float sy = wl_fixed_to_double(sy_w);
|
float sy = wl_fixed_to_double(sy_w);
|
||||||
|
|
||||||
|
input->sx = sx;
|
||||||
|
input->sy = sy;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
/* when making the window smaller - e.g. after a unmaximise we might
|
/* when making the window smaller - e.g. after a unmaximise we might
|
||||||
* still have a pending motion event that the compositor has picked
|
* still have a pending motion event that the compositor has picked
|
||||||
* based on the old surface dimensions
|
* based on the old surface dimensions
|
||||||
@@ -2912,12 +2918,6 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
|
|||||||
sy > window->main_surface->allocation.height)
|
sy > window->main_surface->allocation.height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
input->sx = sx;
|
|
||||||
input->sy = sy;
|
|
||||||
|
|
||||||
if (!window)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(input->grab && input->grab_button)) {
|
if (!(input->grab && input->grab_button)) {
|
||||||
widget = window_find_widget(window, sx, sy);
|
widget = window_find_widget(window, sx, sy);
|
||||||
input_set_focus_widget(input, widget, sx, sy);
|
input_set_focus_widget(input, widget, sx, sy);
|
||||||
|
|||||||
Reference in New Issue
Block a user