backends: Do not use stack-allocated ClutterEvents

Use ClutterEvent* and clutter_event_new() to always allocate events.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1460
This commit is contained in:
Carlos Garnacho 2020-09-24 17:22:55 +02:00
parent 6664044679
commit 16139efa5c

View File

@ -434,7 +434,7 @@ void
meta_stage_set_active (MetaStage *stage, meta_stage_set_active (MetaStage *stage,
gboolean is_active) gboolean is_active)
{ {
ClutterEvent event = { 0 }; ClutterEvent *event;
/* Used by the native backend to inform accessibility technologies /* Used by the native backend to inform accessibility technologies
* about when the stage loses and gains input focus. * about when the stage loses and gains input focus.
@ -446,12 +446,12 @@ meta_stage_set_active (MetaStage *stage,
if (stage->is_active == is_active) if (stage->is_active == is_active)
return; return;
event.type = CLUTTER_STAGE_STATE; event = clutter_event_new (CLUTTER_STAGE_STATE);
clutter_event_set_stage (&event, CLUTTER_STAGE (stage)); clutter_event_set_stage (event, CLUTTER_STAGE (stage));
event.stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED; event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
if (is_active) if (is_active)
event.stage_state.new_state = CLUTTER_STAGE_STATE_ACTIVATED; event->stage_state.new_state = CLUTTER_STAGE_STATE_ACTIVATED;
/* Emitting this StageState event will result in the stage getting /* Emitting this StageState event will result in the stage getting
* activated or deactivated (with the activated or deactivated signal * activated or deactivated (with the activated or deactivated signal
@ -466,7 +466,8 @@ meta_stage_set_active (MetaStage *stage,
* *
* See http://bugzilla.gnome.org/746670 * See http://bugzilla.gnome.org/746670
*/ */
clutter_stage_event (CLUTTER_STAGE (stage), &event); clutter_stage_event (CLUTTER_STAGE (stage), event);
clutter_event_free (event);
} }
MetaStageWatch * MetaStageWatch *