NULL pointer dereference when an xdg_surface role object is recreated
Thread 1 "weston" received signal SIGSEGV, Segmentation fault.
0x00007ffff7d756fe in weston_desktop_surface_get_surface (surface=0x0) at ../libweston/desktop/surface.c:598
598 return surface->surface;
(gdb) bt
#0 0x00007ffff7d756fe in weston_desktop_surface_get_surface (surface=0x0) at ../libweston/desktop/surface.c:598
#1 0x00007ffff7d78874 in weston_desktop_xdg_surface_protocol_get_toplevel (wl_client=0xda3820, resource=0xd29b20, id=8) at ../libweston/desktop/xdg-shell.c:1242
#2 0x00007ffff7a80be6 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#3 0x00007ffff7a7d4bf in ffi_call_int (cif=cif@entry=0x7fffffffd740, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=closure@entry=0x0) at ../src/x86/ffi64.c:673
#4 0x00007ffff7a8018e in ffi_call (cif=cif@entry=0x7fffffffd740, fn=<optimized out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7fffffffd810) at ../src/x86/ffi64.c:710
#5 0x00007ffff7d05843 in wl_closure_invoke (closure=closure@entry=0x434580, target=<optimized out>, target@entry=0xd29b20, opcode=opcode@entry=1, data=<optimized out>, data@entry=0xda3820, flags=2) at ../src/connection.c:1025
#6 0x00007ffff7d0a0b4 in wl_client_connection_data (fd=<optimized out>, mask=<optimized out>, data=0xda3820) at ../src/wayland-server.c:438
#7 0x00007ffff7d088e2 in wl_event_loop_dispatch (loop=0x415280, timeout=timeout@entry=-1) at ../src/event-loop.c:1027
#8 0x00007ffff7d09125 in wl_display_run (display=0x415190) at ../src/wayland-server.c:1493
#9 0x00007ffff7fb2723 in wet_main (argc=1, argv=0x7fffffffe388, test_data=0x0) at ../compositor/main.c:4226
#10 0x000000000040114b in main (argc=1, argv=0x7fffffffe388) at ../compositor/executable.c:33
Tested with 23ea8655
Reproducible with randfall (build/cases/xdg_surface_reassign_role_same
)