Gnome Shell coredumps when being restarted from non zero workspace
Hi,
All is going smooth when restarting from workspace no.0, though
Checking the workflow I noticed that it looks wrong. In either case we are starting from meta_display_open ():
gboolean meta_display_open (void) {
...
if (meta_should_autostart_x11_display ()) { // L#744
// we a going here
// creating display, and later at L#768 attach a compositor to it
x11_display = meta_x11_display_new (display, &error);
...
}
else { /* does not matter */ }
...
enable_compositor (display); // L#768
...
}
next at meta_x11_display_new (..)
MetaX11Display *meta_x11_display_new (MetaDisplay *display, GError **error) {
...
if (meta_prop_get_cardinal (x11_display, // L#1278
x11_display->xroot,
x11_display->atom__NET_CURRENT_DESKTOP,
¤t_workspace_index))
{
// here we go on restart
...
if (current_workspace != NULL) // L#1290
meta_workspace_activate (current_workspace, timestamp);
}
else { /* here we go on clean start */ }
current workspace is not a NULL for restart case, thus we are going further to meta_workspace_activate () which is a wrapper for more advanced meta_workspace_activate_with_focus ():
void
meta_workspace_activate_with_focus (MetaWorkspace *workspace,
MetaWindow *focus_this,
guint32 timestamp)
{
...
if (workspace->manager->active_workspace == workspace) // L#536
return; // This is what happening on restart from WS#0, we return and all is working fine
// otherwise we continue the flow
...
comp = meta_display_get_compositor (workspace->display); // L#586
/* the code of meta_display_get_compositor() is absolutely straightforward:
return display->compositor;
BUT we have not any compositor yet, thus getting NULL
*/
...
meta_compositor_switch_workspace (comp, old, workspace, direction); // L#636
...
}
that leads us to meta_compositor_switch_workspace ():
void
meta_compositor_switch_workspace (MetaCompositor *compositor,
MetaWorkspace *from,
MetaWorkspace *to,
MetaMotionDirection direction)
{
...
compositor->switch_workspace_in_progress++; // L#832, and voila! we are getting coredump
...
}
like this:
systemd-coredump[3319]: Process 3303 (gnome-shell) of user 1001 dumped core.
Stack trace of thread 3303:
#0 0x00007fd4f572f977 meta_compositor_switch_workspace (libmutter-3.so.0)
#1 0x00007fd4f5769dce meta_workspace_activate_with_focus (libmutter-3.so.0)
#2 0x00007fd4f5772c7e meta_x11_display_new (libmutter-3.so.0)
#3 0x00007fd4f5747bad meta_display_open (libmutter-3.so.0)
#4 0x00007fd4f575335f meta_run (libmutter-3.so.0)
#5 0x000055acbc9e93ab n/a (gnome-shell)
#6 0x00007fd4f67ef223 __libc_start_main (libc.so.6)
#7 0x000055acbc9e950e n/a (gnome-shell)
Just for easier navigation there is meta_display_get_compositor ()
Thanks for reading, and hopefully fixing!
UPD Temporarily fixed it for myself like this:
--- a/src/x11/meta-x11-display.c 2018-10-11 00:09:53.630346118 +1000
+++ b/src/x11/meta-x11-display.c 2018-10-11 00:09:24.676596585 +1000
@@ -1282,13 +1282,10 @@
{
meta_verbose ("Read existing _NET_CURRENT_DESKTOP = %d\n",
(int) current_workspace_index);
-
- /* Switch to the _NET_CURRENT_DESKTOP workspace */
- current_workspace = meta_workspace_manager_get_workspace_by_index (display->workspace_manager,
- current_workspace_index);
-
- if (current_workspace != NULL)
- meta_workspace_activate (current_workspace, timestamp);
+ // we have absolutely virgin display
+ // https://gitlab.gnome.org/GNOME/mutter/blob/master/src/core/display.c#L671
+ // so it does not matter what are target and current workspaces, not having
+ // a compositor yet we would not be able to switch them anyway
}
else
{
Edited by Just Me