[mutter] clutter/backend/native: Don't double manage stage implementation
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/backend/native: Don't double manage stage implementation
- Date: Sat, 13 Mar 2021 19:23:47 +0000 (UTC)
commit 5aa43ec6c4f61fda90cc4eda172538e7bcf4bffc
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Mar 11 21:46:10 2021 +0100
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>
src/backends/native/meta-backend-native.c | 6 +++---
src/backends/native/meta-clutter-backend-native.c | 25 ++++-------------------
src/backends/native/meta-clutter-backend-native.h | 2 --
src/backends/native/meta-onscreen-native.c | 7 +++----
4 files changed, 10 insertions(+), 30 deletions(-)
---
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index f0c2fadaa6..5231d432c6 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -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);
diff --git a/src/backends/native/meta-clutter-backend-native.c
b/src/backends/native/meta-clutter-backend-native.c
index 46156d8988..2d6a6b1dd2 100644
--- a/src/backends/native/meta-clutter-backend-native.c
+++ b/src/backends/native/meta-clutter-backend-native.c
@@ -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,
- "backend", clutter_backend,
- "wrapper", wrapper,
- NULL);
- return CLUTTER_STAGE_WINDOW (clutter_backend_native->stage_native);
+ return g_object_new (META_TYPE_STAGE_NATIVE,
+ "backend", clutter_backend,
+ "wrapper", wrapper,
+ NULL);
}
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);
}
diff --git a/src/backends/native/meta-clutter-backend-native.h
b/src/backends/native/meta-clutter-backend-native.h
index 0dfc3e4aa0..dea35988c0 100644
--- a/src/backends/native/meta-clutter-backend-native.h
+++ b/src/backends/native/meta-clutter-backend-native.h
@@ -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 */
diff --git a/src/backends/native/meta-onscreen-native.c b/src/backends/native/meta-onscreen-native.c
index 7c0fb51333..53388e3f64 100644
--- a/src/backends/native/meta-onscreen-native.c
+++ b/src/backends/native/meta-onscreen-native.c
@@ -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));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]