[mutter] compositor/plugin-manager: Split start() from new()
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] compositor/plugin-manager: Split start() from new()
- Date: Tue, 25 Jan 2022 15:04:52 +0000 (UTC)
commit 5b720a157cfa71ae855d8206b4a6eeb3cdf18eec
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jan 18 19:25:57 2022 +0100
compositor/plugin-manager: Split start() from new()
In order to support dynamic imports, gjs added an implicit mainloop
that can drive the main context independently from other mainloops
like the one from GApplication or MetaContext.
That means that sources can now get dispatched to the main context
from the moment the plugin is started, resulting in a crash as the
association between compositor and plugin manager doesn't exist until
meta_plugin_manager_new() returns.
Make sure this doesn't happen by only starting the plugin after
meta_plugin_manager_new() has returned.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2242>
src/compositor/compositor.c | 1 +
src/compositor/meta-plugin-manager.c | 16 ++++++++++------
src/compositor/meta-plugin-manager.h | 2 ++
3 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index ee6be007b8..7d14068fdf 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -548,6 +548,7 @@ meta_compositor_do_manage (MetaCompositor *compositor,
return FALSE;
priv->plugin_mgr = meta_plugin_manager_new (compositor);
+ meta_plugin_manager_start (priv->plugin_mgr);
return TRUE;
}
diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c
index ab7fce663d..94d62c2126 100644
--- a/src/compositor/meta-plugin-manager.c
+++ b/src/compositor/meta-plugin-manager.c
@@ -97,7 +97,6 @@ MetaPluginManager *
meta_plugin_manager_new (MetaCompositor *compositor)
{
MetaPluginManager *plugin_mgr;
- MetaPluginClass *klass;
MetaPlugin *plugin;
MetaMonitorManager *monitors;
@@ -107,11 +106,6 @@ meta_plugin_manager_new (MetaCompositor *compositor)
_meta_plugin_set_compositor (plugin, compositor);
- klass = META_PLUGIN_GET_CLASS (plugin);
-
- if (klass->start)
- klass->start (plugin);
-
monitors = meta_monitor_manager_get ();
g_signal_connect (monitors, "confirm-display-change",
G_CALLBACK (on_confirm_display_change), plugin_mgr);
@@ -119,6 +113,16 @@ meta_plugin_manager_new (MetaCompositor *compositor)
return plugin_mgr;
}
+void
+meta_plugin_manager_start (MetaPluginManager *plugin_mgr)
+{
+ MetaPlugin *plugin = plugin_mgr->plugin;
+ MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
+
+ if (klass->start)
+ klass->start (plugin);
+}
+
static void
meta_plugin_manager_kill_window_effects (MetaPluginManager *plugin_mgr,
MetaWindowActor *actor)
diff --git a/src/compositor/meta-plugin-manager.h b/src/compositor/meta-plugin-manager.h
index d1c007fa19..a5fe0315ab 100644
--- a/src/compositor/meta-plugin-manager.h
+++ b/src/compositor/meta-plugin-manager.h
@@ -45,6 +45,8 @@ typedef struct MetaPluginManager MetaPluginManager;
MetaPluginManager * meta_plugin_manager_new (MetaCompositor *compositor);
+void meta_plugin_manager_start (MetaPluginManager *plugin_mgr);
+
META_EXPORT_TEST
void meta_plugin_manager_load (const gchar *plugin_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]