From 906920cb333486fd9ecd553cc819e2cd9799da6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 5 Jul 2024 00:20:23 +0200 Subject: [PATCH] compositor: Handle skipped transition in visual bell Implicit transitions may be skipped, for example when the actor isn't currently mapped. Failing to check for that case not only results in a couple of warnings, it also means that the "flash" actor is never destroyed, and the window remains darkened. Close: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7760 Part-of: --- src/compositor/compositor.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index 94d392162..c72276823 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -1382,15 +1382,21 @@ meta_compositor_flash_window (MetaCompositor *compositor, clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD); clutter_actor_set_easing_duration (flash, FLASH_TIME_MS); clutter_actor_set_opacity (flash, 192); + clutter_actor_restore_easing_state (flash); transition = clutter_actor_get_transition (flash, "opacity"); - clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE); - clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2); + if (transition) + { + clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE); + clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2); - g_signal_connect (transition, "stopped", - G_CALLBACK (window_flash_out_completed), flash); - - clutter_actor_restore_easing_state (flash); + g_signal_connect (transition, "stopped", + G_CALLBACK (window_flash_out_completed), flash); + } + else /* implicit transition was skipped, likely because the window is hidden */ + { + clutter_actor_destroy (flash); + } } /**