Repository navigation
Conversation
When Gala is shutting down with an active modal dialog, destroying the Clutter stage can trigger `pop_modal()` through the `child-removed` signal. At this point, Mutter may have already destroyed the compositor, causing a crash when `pop_modal()` attempts to re-enable unredirect. Connect to the display's `closing` signal and skip further modal cleanup operations during shutdown.
leolost2605
left a comment
There was a problem hiding this comment.
Hmm this feels like a workaround. What do you mean by compositor destroyed? Is it actually gone or does calling enable_unredirect on it crash because some compositor internal state is gone? If it's actually gone couldn't we check if display.get_compositor returns null and then dont call enable unredirect?
|
I tried the Here are the two backtraces: 1. Without the NULL check:#0 meta_compositor_enable_unredirect (compositor=0x0) at ../mutter/src/compositor/compositor.c:1367
#1 0x000056205b55a78e in gala_window_manager_gala_real_pop_modal (base=<optimized out>, proxy=0x562073bd4660)
at src/gala.p/WindowManager.c:2778
#2 gala_window_manager_gala_real_pop_modal (base=<optimized out>, proxy=0x562073bd4660) at src/gala.p/WindowManager.c:2740
#3 0x000056205b5c3aa9 in gala_modal_group_on_child_removed (self=0x562073275b60, child=<optimized out>)
at src/gala.p/Widgets/ModalGroup.c:312
#4 _gala_modal_group_on_child_removed_clutter_actor_child_removed (_sender=<optimized out>, child=<optimized out>,
self=0x562073275b60) at src/gala.p/Widgets/ModalGroup.c:425
#5 0x00007f6f8314abfc in g_closure_invoke (closure=0x562073284a80, return_value=0x0, n_param_values=2,
param_values=0x7ffe3c4c3d20, invocation_hint=0x7ffe3c4c3c70) at ../glib/gobject/gclosure.c:916
#6 0x00007f6f8316acfb in signal_emit_unlocked_R (node=node@entry=0x7ffe3c4c3e60, detail=detail@entry=0,
instance=instance@entry=0x562073283930, emission_return=emission_return@entry=0x0,
instance_and_params=instance_and_params@entry=0x7ffe3c4c3d20) at ../glib/gobject/gsignal.c:3929
#7 0x00007f6f8316ced4 in signal_emit_valist_unlocked (instance=instance@entry=0x562073283930, signal_id=signal_id@entry=258,
detail=detail@entry=0, var_args=var_args@entry=0x7ffe3c4c3fc0) at ../glib/gobject/gsignal.c:3561
#8 0x00007f6f8316d179 in g_signal_emit_valist (instance=0x562073283930, signal_id=258, detail=0, var_args=0x7ffe3c4c3fc0)
at ../glib/gobject/gsignal.c:3304
#9 0x00007f6f8316d234 in g_signal_emit (instance=instance@entry=0x562073283930, signal_id=<optimized out>,
detail=detail@entry=0) at ../glib/gobject/gsignal.c:3624
#10 0x00007f6f818efa12 in clutter_actor_remove_child_internal (self=<optimized out>, child=<optimized out>,
flags=<optimized out>) at ../mutter/clutter/clutter/clutter-actor.c:4138
#11 0x00007f6f818ee26d in clutter_actor_dispose (object=0x562074660ac0) at ../mutter/clutter/clutter/clutter-actor.c:5437
#12 0x00007f6f8315c1ef in g_object_run_dispose (object=0x562074660ac0) at ../glib/gobject/gobject.c:1917
#13 g_object_run_dispose (object=0x562074660ac0) at ../glib/gobject/gobject.c:1907
#14 0x00007f6f8190fd1f in clutter_actor_destroy (self=0x562074660ac0) at ../mutter/clutter/clutter/clutter-actor.c:7760
#15 clutter_actor_destroy_all_children (self=0x562073283930) at ../mutter/clutter/clutter/clutter-actor.c:11703
#16 0x00007f6f8314ab0d in g_closure_invoke (closure=0x562073019a90, return_value=0x0, n_param_values=1,
param_values=0x7ffe3c4c43b0, invocation_hint=0x7ffe3c4c4300) at ../glib/gobject/gclosure.c:916
#17 0x00007f6f8316b173 in signal_emit_unlocked_R (node=node@entry=0x7ffe3c4c44d0, detail=detail@entry=0,
instance=instance@entry=0x562073283930, emission_return=emission_return@entry=0x0,
instance_and_params=instance_and_params@entry=0x7ffe3c4c43b0) at ../glib/gobject/gsignal.c:4049
#18 0x00007f6f8316ced4 in signal_emit_valist_unlocked (instance=instance@entry=0x562073283930, signal_id=signal_id@entry=230,
detail=detail@entry=0, var_args=var_args@entry=0x7ffe3c4c4630) at ../glib/gobject/gsignal.c:3561
#19 0x00007f6f8316d179 in g_signal_emit_valist (instance=0x562073283930, signal_id=230, detail=0, var_args=0x7ffe3c4c4630)
at ../glib/gobject/gsignal.c:3304
#20 0x00007f6f8316d234 in g_signal_emit (instance=instance@entry=0x562073283930, signal_id=<optimized out>,
detail=detail@entry=0) at ../glib/gobject/gsignal.c:3624
#21 0x00007f6f818ee259 in clutter_actor_dispose (object=0x562073283930) at ../mutter/clutter/clutter/clutter-actor.c:5431
#22 0x00007f6f8315c1ef in g_object_run_dispose (object=0x562073283930) at ../glib/gobject/gobject.c:1917
#23 g_object_run_dispose (object=0x562073283930) at ../glib/gobject/gobject.c:1907
#24 0x00007f6f8190fd1f in clutter_actor_destroy (self=0x562073283930) at ../mutter/clutter/clutter/clutter-actor.c:7760
#25 clutter_actor_destroy_all_children (self=0x562073275b60) at ../mutter/clutter/clutter/clutter-actor.c:11703
#26 0x00007f6f8314ab0d in g_closure_invoke (closure=0x562073019a90, return_value=0x0, n_param_values=1,
param_values=0x7ffe3c4c49b0, invocation_hint=0x7ffe3c4c4900) at ../glib/gobject/gclosure.c:916
#27 0x00007f6f8316b173 in signal_emit_unlocked_R (node=node@entry=0x7ffe3c4c4ad0, detail=detail@entry=0,
instance=instance@entry=0x562073275b60, emission_return=emission_return@entry=0x0,
instance_and_params=instance_and_params@entry=0x7ffe3c4c49b0) at ../glib/gobject/gsignal.c:4049
#28 0x00007f6f8316ced4 in signal_emit_valist_unlocked (instance=instance@entry=0x562073275b60, signal_id=signal_id@entry=230,
detail=detail@entry=0, var_args=var_args@entry=0x7ffe3c4c4c30) at ../glib/gobject/gsignal.c:3561
#29 0x00007f6f8316d179 in g_signal_emit_valist (instance=0x562073275b60, signal_id=230, detail=0, var_args=0x7ffe3c4c4c30)
at ../glib/gobject/gsignal.c:3304
#30 0x00007f6f8316d234 in g_signal_emit (instance=instance@entry=0x562073275b60, signal_id=<optimized out>,
detail=detail@entry=0) at ../glib/gobject/gsignal.c:3624
#31 0x00007f6f818ee259 in clutter_actor_dispose (object=0x562073275b60) at ../mutter/clutter/clutter/clutter-actor.c:5431
#32 0x00007f6f8315c1ef in g_object_run_dispose (object=0x562073275b60) at ../glib/gobject/gobject.c:1917
#33 g_object_run_dispose (object=0x562073275b60) at ../glib/gobject/gobject.c:1907
#34 0x00007f6f8190fd1f in clutter_actor_destroy (self=0x562073275b60) at ../mutter/clutter/clutter/clutter-actor.c:7760
#35 clutter_actor_destroy_all_children (self=0x5620730b7620) at ../mutter/clutter/clutter/clutter-actor.c:11703
#36 0x00007f6f8314abfc in g_closure_invoke (closure=0x562073019a90, return_value=0x0, n_param_values=1,
param_values=0x7ffe3c4c4fb0, invocation_hint=0x7ffe3c4c4f00) at ../glib/gobject/gclosure.c:916
#37 0x00007f6f8316b173 in signal_emit_unlocked_R (node=node@entry=0x7ffe3c4c50d0, detail=detail@entry=0,
instance=instance@entry=0x5620730b7620, emission_return=emission_return@entry=0x0,
instance_and_params=instance_and_params@entry=0x7ffe3c4c4fb0) at ../glib/gobject/gsignal.c:4049
#38 0x00007f6f8316ced4 in signal_emit_valist_unlocked (instance=instance@entry=0x5620730b7620, signal_id=signal_id@entry=230,
detail=detail@entry=0, var_args=var_args@entry=0x7ffe3c4c5230) at ../glib/gobject/gsignal.c:3561
#39 0x00007f6f8316d179 in g_signal_emit_valist (instance=0x5620730b7620, signal_id=230, detail=0, var_args=0x7ffe3c4c5230)
at ../glib/gobject/gsignal.c:3304
#40 0x00007f6f8316d234 in g_signal_emit (instance=instance@entry=0x5620730b7620, signal_id=<optimized out>,
detail=detail@entry=0) at ../glib/gobject/gsignal.c:3624
#41 0x00007f6f818ee259 in clutter_actor_dispose (object=0x5620730b7620) at ../mutter/clutter/clutter/clutter-actor.c:5431
#42 0x00007f6f8315c1ef in g_object_run_dispose (object=0x5620730b7620) at ../glib/gobject/gobject.c:1917
#43 g_object_run_dispose (object=0x5620730b7620) at ../glib/gobject/gobject.c:1907
#44 0x00007f6f8190fd1f in clutter_actor_destroy (self=0x5620730b7620) at ../mutter/clutter/clutter/clutter-actor.c:7760
#45 clutter_actor_destroy_all_children (self=0x562071100830) at ../mutter/clutter/clutter/clutter-actor.c:11703
#46 0x00007f6f81977c70 in clutter_actor_destroy_all_children (self=0x562071100830)
at ../mutter/clutter/clutter/clutter-actor.c:11695
#47 clutter_stage_dispose (object=0x562071100830) at ../mutter/clutter/clutter/clutter-stage.c:1335
#48 0x00007f6f8315c1ef in g_object_run_dispose (object=0x562071100830) at ../glib/gobject/gobject.c:1917
#49 g_object_run_dispose (object=0x562071100830) at ../glib/gobject/gobject.c:1907
#50 0x00007f6f818e926f in clutter_actor_destroy (self=0x562071100830) at ../mutter/clutter/clutter/clutter-actor.c:7760
#51 0x00007f6f81a77548 in meta_backend_dispose (object=0x5620710fa9a0) at ../mutter/src/backends/meta-backend.c:245
#52 0x00007f6f81bdbb01 in meta_backend_native_dispose (object=<optimized out>)
at ../mutter/src/backends/native/meta-backend-native.c:109
#53 0x00007f6f8315c1ef in g_object_run_dispose (object=0x5620710fa9a0) at ../glib/gobject/gobject.c:1917
#54 g_object_run_dispose (object=0x5620710fa9a0) at ../glib/gobject/gobject.c:1907
#55 0x00007f6f81b0129f in meta_backend_destroy (backend=0x5620710fa9a0) at ../mutter/src/backends/meta-backend.c:294
#56 meta_context_dispose (object=0x5620710ef830) at ../mutter/src/core/meta-context.c:813
#57 0x00007f6f8315be68 in g_object_unref (_object=0x5620710ef830) at ../glib/gobject/gobject.c:4839
#58 0x000056205b5cfe78 in block45_data_unref (_userdata_=0x5620710d4310) at src/gala.p/Main.c:115
#59 block45_data_unref (_userdata_=0x5620710d4310) at src/gala.p/Main.c:110
#60 0x000056205b5d57a0 in gala_main (args=<optimized out>, args_length1=<optimized out>) at src/gala.p/Main.c:344
#61 0x00007f6f80c27781 in __libc_start_call_main (main=main@entry=0x56205b556070 <main>, argc=argc@entry=1,
argv=argv@entry=0x7ffe3c4c5978) at ../sysdeps/nptl/libc_start_call_main.h:59
#62 0x00007f6f80c278b9 in __libc_start_main_impl (main=0x56205b556070 <main>, argc=1, argv=0x7ffe3c4c5978,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe3c4c5968)
at ../csu/libc-start.c:372
#63 0x000056205b5560b5 in _start ()2. With the NULL check:So skipping The proposed closing signal check avoids both crashes, while still removing the proxy from the modal stack. |
|
I had a look at the destruction order in mutter: the display (which also owns the compositor which in turn owns the plugin) does in fact go away pretty much first and after that it can't be used even though meta_plugin_get_display () still returns it :/ |
|
I'm not familiar enough with Gala's and Mutter's internals to have a strong opinion on the implementation, so I'm happy with whatever approach you think is best. I just want to make sure Gala doesn't crash on logout. :) |
Try apply common design pattern like facade I forget the name but wrap |
I'm happy to try my own suggestion on your pr but need about a week to try? |
Im not sure that's worth it for something that could kind of be considered a bug in mutter. Also we would need to guard every access to display not only through wm. I think it's fine to say that we should just make sure that we can't use the display after it has been closed.
@City-busz I would go with the second approach then i.e. just destroy the ui group on |
When Gala is shutting down with an active modal dialog, destroying the Clutter stage can trigger
pop_modal()through thechild-removedsignal.At this point, Mutter may have already destroyed the compositor, causing a crash when
pop_modal()attempts to re-enable unredirect.Connect to the display's
closingsignal and skip further modal cleanup operations during shutdown.