shell: deal with weston_compositor_pick_surface() = NULL
I could crash Weston by trying to open another menu from a panel while one menu from it was already showing. Program received signal SIGSEGV, Segmentation fault. 0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440 440 if (surface->resource.client == client) { (gdb) bt 0 0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440 1 0x0000000000406977 in weston_device_repick (device=0x70b4e0, time=4130706528) at compositor.c:360 2 0x0000000000406a36 in weston_compositor_repick (compositor=0x619960) at compositor.c:382 3 0x0000000000406ac8 in destroy_surface (resource=0x6fc6f0) at compositor.c:397 4 0x00007ffff7bd33d8 in destroy_resource (element=0x6fc6f0, data=0x7fffffffd9fc) at wayland-server.c:355 5 0x00007ffff7bd8d98 in for_each_helper (entries=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc) at wayland-util.c:264 6 0x00007ffff7bd8dd4 in wl_map_for_each (map=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc) at wayland-util.c:270 7 0x00007ffff7bd34dc in wl_client_destroy (client=0x7577d0) at wayland-server.c:385 8 0x00007ffff7bd2e36 in wl_client_connection_data (fd=17, mask=1, data=0x7577d0) at wayland-server.c:187 9 0x00007ffff7bd5bde in wl_event_source_fd_dispatch (source=0x74cda0, ep=0x7fffffffdae0) at event-loop.c:76 10 0x00007ffff7bd665b in wl_event_loop_dispatch (loop=0x618900, timeout=-1) at event-loop.c:462 11 0x00007ffff7bd42a9 in wl_display_run (display=0x6188b0) at wayland-server.c:785 12 0x000000000040b1e1 in main (argc=1, argv=0x7fffffffdef8) at compositor.c:2182 Modify popup_grab_focus() to deal with a NULL surface. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
6d174cff7a
commit
cb108439d2
@ -437,7 +437,7 @@ popup_grab_focus(struct wl_grab *grab, uint32_t time,
|
||||
container_of(grab, struct shell_surface, popup.grab);
|
||||
struct wl_client *client = priv->surface->surface.resource.client;
|
||||
|
||||
if (surface->resource.client == client) {
|
||||
if (surface && surface->resource.client == client) {
|
||||
wl_input_device_set_pointer_focus(device, surface, time,
|
||||
device->x, device->y, x, y);
|
||||
grab->focus = surface;
|
||||
|
Loading…
Reference in New Issue
Block a user