clutter/actor: Don't emit focus signals during destruction

We rightfully unset the stage focus when the focus actor is destroyed,
which in turns results in the ClutterActor::-key-focus-out signal being
emitted on an actor that is no longer fully valid.

Avoid that emission, so consumers don't have to deal with half-disposed
actors in their handler.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4324

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1884>
This commit is contained in:
Florian Müllner 2021-06-02 16:24:25 +02:00
parent ea626a5059
commit dce3aa5c01

View File

@ -14584,6 +14584,9 @@ _clutter_actor_set_has_key_focus (ClutterActor *self,
{
priv->has_key_focus = has_key_focus;
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
return;
if (has_key_focus)
g_signal_emit (self, actor_signals[KEY_FOCUS_IN], 0);
else