clutter/backend/native: Don't double manage stage implementation

The stage owns the "stage window", so don't double manage it in
MetaClutterBackendNative, as that means it'd be double-destroyed if the
stage would be destroyed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1775>
This commit is contained in:
Jonas Ådahl 2021-03-11 21:46:10 +01:00 committed by Marge Bot
parent c016437857
commit 5aa43ec6c4
4 changed files with 10 additions and 30 deletions

View File

@ -375,11 +375,11 @@ static void
meta_backend_native_update_screen_size (MetaBackend *backend,
int width, int height)
{
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
MetaStageNative *stage_native;
ClutterActor *stage = meta_backend_get_stage (backend);
ClutterStageWindow *stage_window =
_clutter_stage_get_window (CLUTTER_STAGE (stage));
MetaStageNative *stage_native = META_STAGE_NATIVE (stage_window);
stage_native = meta_clutter_backend_native_get_stage_native (clutter_backend);
meta_stage_native_rebuild_views (stage_native);
clutter_actor_set_size (stage, width, height);

View File

@ -56,21 +56,11 @@ struct _MetaClutterBackendNative
ClutterBackend parent;
MetaSeatNative *main_seat;
MetaStageNative *stage_native;
};
G_DEFINE_TYPE (MetaClutterBackendNative, meta_clutter_backend_native,
CLUTTER_TYPE_BACKEND)
MetaStageNative *
meta_clutter_backend_native_get_stage_native (ClutterBackend *clutter_backend)
{
MetaClutterBackendNative *clutter_backend_native =
META_CLUTTER_BACKEND_NATIVE (clutter_backend);
return clutter_backend_native->stage_native;
}
static CoglRenderer *
meta_clutter_backend_native_get_renderer (ClutterBackend *clutter_backend,
GError **error)
@ -86,16 +76,10 @@ meta_clutter_backend_native_create_stage (ClutterBackend *clutter_backend,
ClutterStage *wrapper,
GError **error)
{
MetaClutterBackendNative *clutter_backend_native =
META_CLUTTER_BACKEND_NATIVE (clutter_backend);
g_assert (!clutter_backend_native->stage_native);
clutter_backend_native->stage_native = g_object_new (META_TYPE_STAGE_NATIVE,
return g_object_new (META_TYPE_STAGE_NATIVE,
"backend", clutter_backend,
"wrapper", wrapper,
NULL);
return CLUTTER_STAGE_WINDOW (clutter_backend_native->stage_native);
}
static void
@ -144,7 +128,6 @@ meta_clutter_backend_native_finalize (GObject *object)
META_CLUTTER_BACKEND_NATIVE (object);
g_clear_object (&clutter_backend_native->main_seat);
g_clear_object (&clutter_backend_native->stage_native);
G_OBJECT_CLASS (meta_clutter_backend_native_parent_class)->finalize (object);
}

View File

@ -35,6 +35,4 @@ G_DECLARE_FINAL_TYPE (MetaClutterBackendNative, meta_clutter_backend_native,
META, CLUTTER_BACKEND_NATIVE,
ClutterBackend)
MetaStageNative * meta_clutter_backend_native_get_stage_native (ClutterBackend *backend);
#endif /* META_CLUTTER_BACKEND_NATIVE_H */

View File

@ -1314,13 +1314,12 @@ add_onscreen_frame_info (MetaCrtc *crtc)
{
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
MetaBackend *backend = meta_gpu_get_backend (gpu);
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
MetaStageNative *stage_native =
meta_clutter_backend_native_get_stage_native (clutter_backend);
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
ClutterStageWindow *stage_window = _clutter_stage_get_window (stage);
MetaRenderer *renderer = meta_backend_get_renderer (backend);
MetaRendererView *view = meta_renderer_get_view_for_crtc (renderer, crtc);
clutter_stage_cogl_add_onscreen_frame_info (CLUTTER_STAGE_COGL (stage_native),
clutter_stage_cogl_add_onscreen_frame_info (CLUTTER_STAGE_COGL (stage_window),
CLUTTER_STAGE_VIEW (view));
}