Skip to content

Fix crash when closing with active modal dialogs - #2973

Open
City-busz wants to merge 1 commit into
elementary:mainfrom
City-busz:fix-logout-crash
Open

City-busz wants to merge 1 commit into
elementary:mainfrom
City-busz:fix-logout-crash

Conversation

@City-busz

Copy link
Copy Markdown
Contributor

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.

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 leolost2605 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@City-busz

Copy link
Copy Markdown
Contributor Author

I tried the NULL check you suggested, but it only prevented the first crash.

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:
#0  0x00007f77544ee44f in meta_display_focus_default_window (display=0x5611f1277a70, timestamp=0)
    at ../mutter/src/core/display.c:3144
#1  0x00005611edc1ea89 in gala_modal_group_on_child_removed (self=0x5611f34ad520, child=<optimized out>)
    at src/gala.p/Widgets/ModalGroup.c:312
#2  _gala_modal_group_on_child_removed_clutter_actor_child_removed (_sender=<optimized out>, 
    child=<optimized out>, self=0x5611f34ad520) at src/gala.p/Widgets/ModalGroup.c:425
#3  0x00007f7755a92bfc in g_closure_invoke (closure=0x5611f34b2f10, return_value=0x0, n_param_values=2, 
    param_values=0x7ffd6f5829a0, invocation_hint=0x7ffd6f5828f0) at ../glib/gobject/gclosure.c:916
#4  0x00007f7755ab2cfb in signal_emit_unlocked_R (node=node@entry=0x7ffd6f582ae0, detail=detail@entry=0, 
    instance=instance@entry=0x5611f34a8b00, emission_return=emission_return@entry=0x0, 
    instance_and_params=instance_and_params@entry=0x7ffd6f5829a0) at ../glib/gobject/gsignal.c:3929
#5  0x00007f7755ab4ed4 in signal_emit_valist_unlocked (instance=instance@entry=0x5611f34a8b00, 
    signal_id=signal_id@entry=258, detail=detail@entry=0, var_args=var_args@entry=0x7ffd6f582c40)
    at ../glib/gobject/gsignal.c:3561
#6  0x00007f7755ab5179 in g_signal_emit_valist (instance=0x5611f34a8b00, signal_id=258, detail=0, 
    var_args=0x7ffd6f582c40) at ../glib/gobject/gsignal.c:3304
#7  0x00007f7755ab5234 in g_signal_emit (instance=instance@entry=0x5611f34a8b00, signal_id=<optimized out>, 
    detail=detail@entry=0) at ../glib/gobject/gsignal.c:3624
#8  0x00007f77542efa12 in clutter_actor_remove_child_internal (self=<optimized out>, child=<optimized out>, 
    flags=<optimized out>) at ../mutter/clutter/clutter/clutter-actor.c:4138
#9  0x00007f77542ee26d in clutter_actor_dispose (object=0x5611f43ca620)
    at ../mutter/clutter/clutter/clutter-actor.c:5437
#10 0x00007f7755aa41ef in g_object_run_dispose (object=0x5611f43ca620) at ../glib/gobject/gobject.c:1917
#11 g_object_run_dispose (object=0x5611f43ca620) at ../glib/gobject/gobject.c:1907
#12 0x00007f775430fd1f in clutter_actor_destroy (self=0x5611f43ca620)
    at ../mutter/clutter/clutter/clutter-actor.c:7760
#13 clutter_actor_destroy_all_children (self=0x5611f34a8b00)
    at ../mutter/clutter/clutter/clutter-actor.c:11703
#14 0x00007f7755a92b0d in g_closure_invoke (closure=0x5611f3261fe0, return_value=0x0, n_param_values=1, 
    param_values=0x7ffd6f583030, invocation_hint=0x7ffd6f582f80) at ../glib/gobject/gclosure.c:916
#15 0x00007f7755ab3173 in signal_emit_unlocked_R (node=node@entry=0x7ffd6f583150, detail=detail@entry=0, 
    instance=instance@entry=0x5611f34a8b00, emission_return=emission_return@entry=0x0, 
    instance_and_params=instance_and_params@entry=0x7ffd6f583030) at ../glib/gobject/gsignal.c:4049
#16 0x00007f7755ab4ed4 in signal_emit_valist_unlocked (instance=instance@entry=0x5611f34a8b00, 
    signal_id=signal_id@entry=230, detail=detail@entry=0, var_args=var_args@entry=0x7ffd6f5832b0)
    at ../glib/gobject/gsignal.c:3561
#17 0x00007f7755ab5179 in g_signal_emit_valist (instance=0x5611f34a8b00, signal_id=230, detail=0, 
    var_args=0x7ffd6f5832b0) at ../glib/gobject/gsignal.c:3304
#18 0x00007f7755ab5234 in g_signal_emit (instance=instance@entry=0x5611f34a8b00, signal_id=<optimized out>, 
    detail=detail@entry=0) at ../glib/gobject/gsignal.c:3624
#19 0x00007f77542ee259 in clutter_actor_dispose (object=0x5611f34a8b00)
    at ../mutter/clutter/clutter/clutter-actor.c:5431
#20 0x00007f7755aa41ef in g_object_run_dispose (object=0x5611f34a8b00) at ../glib/gobject/gobject.c:1917
#21 g_object_run_dispose (object=0x5611f34a8b00) at ../glib/gobject/gobject.c:1907
#22 0x00007f775430fd1f in clutter_actor_destroy (self=0x5611f34a8b00)
    at ../mutter/clutter/clutter/clutter-actor.c:7760
#23 clutter_actor_destroy_all_children (self=0x5611f34ad520)
    at ../mutter/clutter/clutter/clutter-actor.c:11703
#24 0x00007f7755a92b0d in g_closure_invoke (closure=0x5611f3261fe0, return_value=0x0, n_param_values=1, 
    param_values=0x7ffd6f583630, invocation_hint=0x7ffd6f583580) at ../glib/gobject/gclosure.c:916
#25 0x00007f7755ab3173 in signal_emit_unlocked_R (node=node@entry=0x7ffd6f583750, detail=detail@entry=0, 
    instance=instance@entry=0x5611f34ad520, emission_return=emission_return@entry=0x0, 
    instance_and_params=instance_and_params@entry=0x7ffd6f583630) at ../glib/gobject/gsignal.c:4049
#26 0x00007f7755ab4ed4 in signal_emit_valist_unlocked (instance=instance@entry=0x5611f34ad520, 
    signal_id=signal_id@entry=230, detail=detail@entry=0, var_args=var_args@entry=0x7ffd6f5838b0)
    at ../glib/gobject/gsignal.c:3561
#27 0x00007f7755ab5179 in g_signal_emit_valist (instance=0x5611f34ad520, signal_id=230, detail=0, 
    var_args=0x7ffd6f5838b0) at ../glib/gobject/gsignal.c:3304
#28 0x00007f7755ab5234 in g_signal_emit (instance=instance@entry=0x5611f34ad520, signal_id=<optimized out>, 
    detail=detail@entry=0) at ../glib/gobject/gsignal.c:3624
#29 0x00007f77542ee259 in clutter_actor_dispose (object=0x5611f34ad520)
    at ../mutter/clutter/clutter/clutter-actor.c:5431
#30 0x00007f7755aa41ef in g_object_run_dispose (object=0x5611f34ad520) at ../glib/gobject/gobject.c:1917
#31 g_object_run_dispose (object=0x5611f34ad520) at ../glib/gobject/gobject.c:1907
#32 0x00007f775430fd1f in clutter_actor_destroy (self=0x5611f34ad520)
    at ../mutter/clutter/clutter/clutter-actor.c:7760
#33 clutter_actor_destroy_all_children (self=0x5611f328b440)
    at ../mutter/clutter/clutter/clutter-actor.c:11703
#34 0x00007f7755a92bfc in g_closure_invoke (closure=0x5611f3261fe0, return_value=0x0, n_param_values=1, 
    param_values=0x7ffd6f583c30, invocation_hint=0x7ffd6f583b80) at ../glib/gobject/gclosure.c:916
#35 0x00007f7755ab3173 in signal_emit_unlocked_R (node=node@entry=0x7ffd6f583d50, detail=detail@entry=0, 
    instance=instance@entry=0x5611f328b440, emission_return=emission_return@entry=0x0, 
    instance_and_params=instance_and_params@entry=0x7ffd6f583c30) at ../glib/gobject/gsignal.c:4049
#36 0x00007f7755ab4ed4 in signal_emit_valist_unlocked (instance=instance@entry=0x5611f328b440, 
    signal_id=signal_id@entry=230, detail=detail@entry=0, var_args=var_args@entry=0x7ffd6f583eb0)
    at ../glib/gobject/gsignal.c:3561
#37 0x00007f7755ab5179 in g_signal_emit_valist (instance=0x5611f328b440, signal_id=230, detail=0, 
    var_args=0x7ffd6f583eb0) at ../glib/gobject/gsignal.c:3304
#38 0x00007f7755ab5234 in g_signal_emit (instance=instance@entry=0x5611f328b440, signal_id=<optimized out>, 
    detail=detail@entry=0) at ../glib/gobject/gsignal.c:3624
#39 0x00007f77542ee259 in clutter_actor_dispose (object=0x5611f328b440)
    at ../mutter/clutter/clutter/clutter-actor.c:5431
#40 0x00007f7755aa41ef in g_object_run_dispose (object=0x5611f328b440) at ../glib/gobject/gobject.c:1917
#41 g_object_run_dispose (object=0x5611f328b440) at ../glib/gobject/gobject.c:1907
#42 0x00007f775430fd1f in clutter_actor_destroy (self=0x5611f328b440)
    at ../mutter/clutter/clutter/clutter-actor.c:7760
#43 clutter_actor_destroy_all_children (self=0x5611f3159ad0)
    at ../mutter/clutter/clutter/clutter-actor.c:11703
#44 0x00007f7754377c70 in clutter_actor_destroy_all_children (self=0x5611f3159ad0)
    at ../mutter/clutter/clutter/clutter-actor.c:11695
#45 clutter_stage_dispose (object=0x5611f3159ad0) at ../mutter/clutter/clutter/clutter-stage.c:1335
#46 0x00007f7755aa41ef in g_object_run_dispose (object=0x5611f3159ad0) at ../glib/gobject/gobject.c:1917
#47 g_object_run_dispose (object=0x5611f3159ad0) at ../glib/gobject/gobject.c:1907
#48 0x00007f77542e926f in clutter_actor_destroy (self=0x5611f3159ad0)
    at ../mutter/clutter/clutter/clutter-actor.c:7760
#49 0x00007f7754477548 in meta_backend_dispose (object=0x5611f125f9a0)
    at ../mutter/src/backends/meta-backend.c:245
#50 0x00007f77545dbb01 in meta_backend_native_dispose (object=<optimized out>)
    at ../mutter/src/backends/native/meta-backend-native.c:109
#51 0x00007f7755aa41ef in g_object_run_dispose (object=0x5611f125f9a0) at ../glib/gobject/gobject.c:1917
#52 g_object_run_dispose (object=0x5611f125f9a0) at ../glib/gobject/gobject.c:1907
#53 0x00007f775450129f in meta_backend_destroy (backend=0x5611f125f9a0)
    at ../mutter/src/backends/meta-backend.c:294
#54 meta_context_dispose (object=0x5611f1254830) at ../mutter/src/core/meta-context.c:813
#55 0x00007f7755aa3e68 in g_object_unref (_object=0x5611f1254830) at ../glib/gobject/gobject.c:4839
#56 0x00005611edbb0898 in block6_data_unref (_userdata_=0x5611f1239310) at src/gala.p/Main.c:115
#57 block6_data_unref (_userdata_=0x5611f1239310) at src/gala.p/Main.c:110
#58 0x00005611edbbb6c0 in gala_main (args=<optimized out>, args_length1=<optimized out>)
    at src/gala.p/Main.c:346
#59 0x00007f7753627781 in __libc_start_call_main (main=main@entry=0x5611edbb0070 <main>, argc=argc@entry=1, 
    argv=argv@entry=0x7ffd6f5845f8) at ../sysdeps/nptl/libc_start_call_main.h:59
#60 0x00007f77536278b9 in __libc_start_main_impl (main=0x5611edbb0070 <main>, argc=1, argv=0x7ffd6f5845f8, 
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd6f5845e8)
    at ../csu/libc-start.c:372
#61 0x00005611edbb00b5 in _start ()

So skipping enable_unredirect() isn't sufficient. During stage destruction, pop_modal() also attempts to restore the default window focus, which crashes because the workspace is no longer available.

The proposed closing signal check avoids both crashes, while still removing the proxy from the modal stack.

@leolost2605

Copy link
Copy Markdown
Member

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 :/
This means we would need to guard a lot of places where we use wm.get_display () (and can't be sure this place won't be called during destruction) to make sure this crash doesn't happen again.
What do you think about instead of guarding every place where we use the display we just destroy our stuff before that and say calling things on the wm or the display during destruction is undefined behavior and shouldn't be done? I.e. we connect to display.closing and then set the layout manager to null and there in the destructor do ui_group.destroy (), or something like that. Lmk your opinion :)

@City-busz

Copy link
Copy Markdown
Contributor Author

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. :)

@vjr

vjr commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

This means we would need to guard a lot of places where we use wm.get_display ()

Try apply common design pattern like facade I forget the name but wrap wm.get_display () in a self contained self guarded new singleton class call it GuardedWmGetDisplay maybe?

@vjr

vjr commented Nov 15, 2026

Copy link
Copy Markdown
Member

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. :)

I'm happy to try my own suggestion on your pr but need about a week to try?

@leolost2605

Copy link
Copy Markdown
Member

Try apply common design pattern like facade I forget the name but wrap wm.get_display () in a self contained self guarded new singleton class call it GuardedWmGetDisplay maybe?

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.

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. :)

@City-busz I would go with the second approach then i.e. just destroy the ui group on display.closing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants