-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gala crash on startup with mutter 3.3x #634
Comments
So the PR related to building with mutter 3.3x has been merged. We can finally build gala against it, yay ! In this post, I'll detail all the steps I used in order to make everything work. Steps to fix gala with Mutter 3.3xBuilding against Mutter 3.32It seems the upstream gala builds fine agains mutter 3.34 and mutter 3.30 but fails to build agains mutter 3.32. Getting dynamic workspaces to workOk, so I have my gala working, but there is no animations, no dynamic workspace, ... This is not my gala ! It's almost unusable this way :( Fix gala crash on startupOh crap ! I can't even start a session with my newly built gala. I get a stracktrace looking like https://gist.github.com/worldofpeace/8e2d3ff4a442a09454a6b91e69af290b. This function should remove every existing empty workspace except the last one. It does this by looping through each one and checking if the requirements are met. void workspace_removed (Meta.WorkspaceManager manager, int index)
{
var it = workspaces_marked_removed.iterator ();
while (it.next ()) {
var workspace = it.@get ();
if (workspace.index () < 0)
it.remove ();
}
} The callback
Let's see the old behaviour: void workspace_removed (Screen screen, int index)
{
unowned List<Workspace> existing_workspaces = screen.get_workspaces ();
var it = workspaces_marked_removed.iterator ();
while (it.next ()) {
if (existing_workspaces.index (it.@get ()) < 0)
it.remove ();
}
} Gala duplicated the list of existing workspace, and search for each workspace marked removed if it can find it within the existing workspaces, therefore bypassing the internal mutter mechanism to raise an error if it doesn't exists. We would like to use this behaviour, but Ok so fine, workspaces are removed properly but this still crashes. Let's go back to the unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var last_index = manager.get_n_workspaces () - 1;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
unowned Meta.Workspace workspace = manager.get_workspace_by_index (i);
if (Utils.get_n_windows (workspace) < 1
&& workspace.index () != last_index) {
remove_workspace (workspace);
}
} This seems to differ from the old behaviour: var screen = wm.get_screen ();
var last_index = screen.get_n_workspaces () - 1;
unowned GLib.List<Meta.Workspace> workspaces = screen.get_workspaces ();
foreach (var workspace in workspaces) {
if (Utils.get_n_windows (workspace) < 1
&& workspace.index () != last_index) {
remove_workspace (workspace);
}
} We are now looping with indexes directly in order to delete workspaces. This is problematic: the loop delete workspaces, and so the workspace indexes may changes at each loop count. We need to replicate the old behaviour: unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var last_index = manager.get_n_workspaces () - 1;
unowned List<Meta.Workspace> existing_workspaces = null;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
existing_workspaces.append (manager.get_workspace_by_index (i));
}
foreach (var workspace in workspaces) {
if (Utils.get_n_windows (workspace) < 1
&& workspace.index () != last_index) {
remove_workspace (workspace);
}
} We can use this patch in order to fix this: https://gist.github.com/Tireg/a29bf78009f2e6ab65b131cbcfe8486a Fix gala crash when opening a new windowHey, I can now start my session ! But why the hell does opening a window on the spare workspace makes it crash ? Ok so this bug was a tough one and I fixed it only with intuition. Looking similar issues on google, I supposed the current workspace was beeing deleted. When disabling unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var last_index = manager.get_n_workspaces () - 1;
unowned List<Meta.Workspace> existing_workspaces = null;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
existing_workspaces.append (manager.get_workspace_by_index (i));
}
foreach (var workspace in workspaces) {
if (Utils.get_n_windows (workspace) < 1
&& workspace.index () != last_index) {
remove_workspace (workspace);
}
} Within the main Fix crash on leaving an emptied workspaceOk so now I can finally start my session, and open a window without crashing gala. But hey ! When I empty a workspace and I leave it, it still crashes !
So now, we have another bug related to workspace removal. It seems like this one, the Multitasking-View widget is giving us a hard time, even when we don't use it. We should check that the workspaces removal works with mutter 3.3x. Lets see the differences: void remove_workspace (int num)
{
WorkspaceClone? workspace = null;
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
foreach (var child in workspaces.get_children ()) {
unowned WorkspaceClone clone = (WorkspaceClone) child;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
if (manager.get_workspace_by_index (i) == clone.workspace) {
workspace = clone;
break;
}
}
if (workspace != null) {
break;
}
}
[...]
} This also differs from the old behaviour: void remove_workspace (int num)
{
WorkspaceClone? workspace = null;
unowned List<Meta.Workspace> existing_workspaces = screen.get_workspaces ();
foreach (var child in workspaces.get_children ()) {
unowned WorkspaceClone clone = (WorkspaceClone) child;
if (existing_workspaces.index (clone.workspace) < 0) {
workspace = clone;
break;
}
}
[...]
} So in the original version, we loop through each of the Multitasking-View workspaces and check whether they exists (==> we can find them) within the mutter workspaces. If we find one that does not exists, then we delete it. Let's just reuse the old behaviour the same way we did before, using this patch: https://gist.github.com/Tireg/cd97aa57df65706adb12b2f6210f580e Fix workspace reorder glitches with mutter 3.34Phew ! Gala is finally working as expected. But I noticed a strange behaviour when using workspace reordering with mutter 3.34: the multitasking view does not update properly when I move a workspace. I don't immediately see the order changes within the multitasking view. Well with the PR beeing merged, some changes were not applied accordingly for Mutter 3.34. We can finally fix this last issue using this patch: https://gist.github.com/Tireg/dfbf0d7dc12fd8a3e533c808681b109a State of gala with those patchesGala seems to work fine with these patches. I'll probably make a pull request based that summaries everything. I still got some bugs though, and I'd like testing it more in order to eradicate all of the bugs left as a crash is critical. |
Hi there! Thanks for taking so much time on fixing those issue, to make your patch easier to include and review, please open a Pull Request on GitHub (this is a right tutorial https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github if you don't know how to do) |
Thanks @tintou, I was indeed discovering the PR process of Github. I hope I didn't made any mistake ! |
I've noticed something interesting with the multitasking view, both with @Tireg patch and on master: It appears windows in multitasking view aren't drawn/visible. Produced in NixOS 20.03 development, which has a Gnome 3.34 stack. Edit: Also in |
@worldofpeace Is the window drawn if you:
Just to help with debugging. |
@Tireg In all of these scenarios the window isn't drawn. Only when quitting mult-tasking view does it appear. |
@worldofpeace I'm afraid I don't have enough Vala/Gobject/Clutter experience to understand what's actually responsible for drawing the objects. I don't quite get why the icon and close button are drawn as there a sibling of the It seems there is no Gala's code specific for I'll probably lack some time to investigate this but I'll let you know if I find something. |
@Tireg Thanks for looking into it though. I'll pull it into it's separate bug report so others can have an opportunity to observe/investigate. |
Prerequisites
Describe the bug
When gala is built with mutter 3.3x, it crashes on startup.
This bug report follows the discussion in #566.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Gala should start properly
Logs
See logs reported after #566 was merged.
Platform Information
OS: Gentoo
Mutter version: 3.32.2
Additional context
I've already triggered the bug(s) origin. I opened this bug report to track issues related to building against mutter 3.3x.
Within the comment, I'll explained each new bug, what patch is used in order to fix it, and why the original code was buggy.
The text was updated successfully, but these errors were encountered: