MetaPluginManager: don't try to deference a NULL pointer when processing events

This function might be called by components with invalid plugin manager
(as it might happen to MetaWindow when the compositor isn't initialized
properly), so we need to protect ourselves from crashes.

https://bugzilla.gnome.org/show_bug.cgi?id=789223
This commit is contained in:
Marco Trevisan (Treviño) 2017-10-19 20:11:39 -05:00
parent fa37496ffb
commit 74565380aa

View File

@ -153,10 +153,17 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
MetaWindowActor *actor, MetaWindowActor *actor,
MetaPluginEffect event) MetaPluginEffect event)
{ {
MetaPlugin *plugin = plugin_mgr->plugin; MetaPlugin *plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin); MetaPluginClass *klass;
MetaDisplay *display = plugin_mgr->compositor->display; MetaDisplay *display;
gboolean retval = FALSE; gboolean retval;
g_return_val_if_fail (plugin_mgr, FALSE);
plugin = plugin_mgr->plugin;
klass = META_PLUGIN_GET_CLASS (plugin);
display = plugin_mgr->compositor->display;
retval = FALSE;
if (display->display_opening) if (display->display_opening)
return FALSE; return FALSE;