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>
This commit is contained in:
parent
3b400f9a5b
commit
5b720a157c
@ -548,6 +548,7 @@ meta_compositor_do_manage (MetaCompositor *compositor,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
priv->plugin_mgr = meta_plugin_manager_new (compositor);
|
priv->plugin_mgr = meta_plugin_manager_new (compositor);
|
||||||
|
meta_plugin_manager_start (priv->plugin_mgr);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,6 @@ MetaPluginManager *
|
|||||||
meta_plugin_manager_new (MetaCompositor *compositor)
|
meta_plugin_manager_new (MetaCompositor *compositor)
|
||||||
{
|
{
|
||||||
MetaPluginManager *plugin_mgr;
|
MetaPluginManager *plugin_mgr;
|
||||||
MetaPluginClass *klass;
|
|
||||||
MetaPlugin *plugin;
|
MetaPlugin *plugin;
|
||||||
MetaMonitorManager *monitors;
|
MetaMonitorManager *monitors;
|
||||||
|
|
||||||
@ -107,11 +106,6 @@ meta_plugin_manager_new (MetaCompositor *compositor)
|
|||||||
|
|
||||||
_meta_plugin_set_compositor (plugin, compositor);
|
_meta_plugin_set_compositor (plugin, compositor);
|
||||||
|
|
||||||
klass = META_PLUGIN_GET_CLASS (plugin);
|
|
||||||
|
|
||||||
if (klass->start)
|
|
||||||
klass->start (plugin);
|
|
||||||
|
|
||||||
monitors = meta_monitor_manager_get ();
|
monitors = meta_monitor_manager_get ();
|
||||||
g_signal_connect (monitors, "confirm-display-change",
|
g_signal_connect (monitors, "confirm-display-change",
|
||||||
G_CALLBACK (on_confirm_display_change), plugin_mgr);
|
G_CALLBACK (on_confirm_display_change), plugin_mgr);
|
||||||
@ -119,6 +113,16 @@ meta_plugin_manager_new (MetaCompositor *compositor)
|
|||||||
return plugin_mgr;
|
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
|
static void
|
||||||
meta_plugin_manager_kill_window_effects (MetaPluginManager *plugin_mgr,
|
meta_plugin_manager_kill_window_effects (MetaPluginManager *plugin_mgr,
|
||||||
MetaWindowActor *actor)
|
MetaWindowActor *actor)
|
||||||
|
@ -45,6 +45,8 @@ typedef struct MetaPluginManager MetaPluginManager;
|
|||||||
|
|
||||||
MetaPluginManager * meta_plugin_manager_new (MetaCompositor *compositor);
|
MetaPluginManager * meta_plugin_manager_new (MetaCompositor *compositor);
|
||||||
|
|
||||||
|
void meta_plugin_manager_start (MetaPluginManager *plugin_mgr);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
void meta_plugin_manager_load (const gchar *plugin_name);
|
void meta_plugin_manager_load (const gchar *plugin_name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user