Subsurface actor does not get recreated resulting in crash
From the spec:
wl_subsurface::destroy - remove sub-surface interface
The sub-surface interface is removed from the wl_surface object that was turned into a sub-surface with a wl_subcompositor.get_subsurface request. The wl_surface's association to the parent is deleted, and the wl_surface loses its role as a sub-surface. The wl_surface is unmapped immediately.
Right now when calling wl_subsurface_destroy()
on a subsurface object, Mutter will keep the role as subsurface. This is usually not a problem, however, under unfortunate circumstances it can happen that the actor of the subsurface gets destroyed - for example if the parent surface gets destroyed for the subsurface. In this case, Clutter destroys all child actors together with the parent. If later the subsurface gets attached to another parent, no new actor will get created for the subsurface. This is not expected and thus crashes eventually.
I suppose there are two possible fixes:
- make sure to detach subsurface actors before their parent actor gets destroyed (this happens when
wl_subsurface_destroy()
is called before the parent gets destroyed). -
properly delete and recreate the subsurface role - i.e. create a new actor - as the spec requires.The spec says a role is permanent, thus the role should get recycled. We could still recreate the actor, but just making sure it doesn't get deleted is likely better.
The resulting crash:
backtrace
(gdb) bt
#0 __GI_raise (sig=sig@entry=11) at ../sysdeps/unix/sysv/linux/raise.c:49
#1 0x0000000000403006 in dump_gjs_stack_on_signal_handler (signo=11) at ../src/main.c:353
#2 <signal handler called> () at ../sysdeps/unix/sysv/linux/sigaction.c
#3 0x00007fbd3c892747 in meta_surface_actor_get_texture (self=self@entry=0x0) at ../src/compositor/meta-surface-actor.c:407
#4 0x00007fbd3c9062c8 in meta_wayland_actor_surface_real_sync_actor_state (actor_surface=0x34e3f80) at ../src/wayland/meta-wayland-actor-surface.c:185
#5 0x00007fbd3c91bf89 in meta_wayland_subsurface_sync_actor_state (actor_surface=0x34e3f80) at ../src/wayland/meta-wayland-subsurface.c:265
#6 0x00007fbd3c906448 in meta_wayland_actor_surface_sync_actor_state (actor_surface=<optimized out>) at ../src/wayland/meta-wayland-actor-surface.c:291
#7 meta_wayland_actor_surface_real_sync_actor_state (actor_surface=<optimized out>) at ../src/wayland/meta-wayland-actor-surface.c:281
#8 0x00007fbd3c91bf89 in meta_wayland_subsurface_sync_actor_state (actor_surface=0x7fbd142af830) at ../src/wayland/meta-wayland-subsurface.c:265
#9 0x00007fbd3c91ee11 in meta_wayland_surface_role_apply_state (pending=0x331ad70, surface_role=<optimized out>)
at ../src/wayland/meta-wayland-surface.c:1885
#10 meta_wayland_surface_apply_state (surface=surface@entry=0x349d520, state=<optimized out>) at ../src/wayland/meta-wayland-surface.c:832
#11 0x00007fbd3c91f627 in meta_wayland_surface_commit (surface=0x349d520) at ../src/wayland/meta-wayland-surface.c:993
#12 wl_surface_commit (client=<optimized out>, resource=<optimized out>) at ../src/wayland/meta-wayland-surface.c:1158
#13 0x00007fbd3bcbac04 in ffi_call_unix64 () at ../src/x86/unix64.S:76
#14 0x00007fbd3bcba107 in ffi_call (cif=cif@entry=0x7ffc12769210, fn=<optimized out>, rvalue=<optimized out>,
rvalue@entry=0x0, avalue=avalue@entry=0x7ffc127692e0) at ../src/x86/ffi64.c:525
#15 0x00007fbd3c267670 in wl_closure_invoke (closure=closure@entry=0x34bff20, target=<optimized out>,
target@entry=0x34de690, opcode=opcode@entry=6, data=<optimized out>, data@entry=0x330abd0, flags=<optimized out>) at ../src/connection.c:1018
#16 0x00007fbd3c26b6e4 in wl_client_connection_data (fd=<optimized out>, mask=<optimized out>, data=0x330abd0) at ../src/wayland-server.c:432
#17 0x00007fbd3c26a21a in wl_event_loop_dispatch (loop=0x9c5180, timeout=timeout@entry=0) at ../src/event-loop.c:1027
#18 0x00007fbd3c9080b7 in wayland_event_source_dispatch (base=<optimized out>, callback=<optimized out>, data=<optimized out>)
at ../src/wayland/meta-wayland.c:100
#19 0x00007fbd3d5094cf in g_main_dispatch (context=0x60b500) at ../glib/gmain.c:3337
#20 g_main_context_dispatch (context=0x60b500) at ../glib/gmain.c:4055
#21 0x00007fbd3d55d4e8 in g_main_context_iterate.constprop.0 (context=0x60b500, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
at ../glib/gmain.c:4131
#22 0x00007fbd3d508a93 in g_main_loop_run (loop=0x264f1a0) at ../glib/gmain.c:4329
#23 0x00007fbd3c8b28d6 in meta_context_run_main_loop (context=context@entry=0x608870, error=error@entry=0x7ffc12769968) at ../src/core/meta-context.c:403
#24 0x0000000000402898 in main (argc=<optimized out>, argv=<optimized out>) at ../src/main.c:563
See also: