Hi there, this is my first post here and I wasn’t too sure it’s appropriate to post here, let me know if there are better places for it.
I have been developing my first small gnome extension to automatically tile new windows. When testing it on X11 it works great, but when running on Wayland the Gnome Shell crashes when opening the first window.
There is no trace whatsoever in journalctl of the crash, dmesg just gives:
[54144.980986] gnome-shell[2817]: segfault at 5582afadedf8 ip 00007f660dfd0840 sp 00007ffca2ba0310 error 4 in libffi.so.8.1.2[7f660dfd0000+7000] likely on CPU 0 (core 0, socket 0)
[54144.981013] Code: c0 eb dd 0f 1f 80 00 00 00 00 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 83 ec 38 64 48 8b 0c 25 28 00 00 00 48 89 4d c8 31 c9 <66> 83 7f 0a 0f 0f 87 65 fd ff ff 0f b7 4f 0a 48 89 f3 48 8d 35 a7
[54220.627739] gnome-shell[62218]: segfault at 18 ip 00007f87412ee2d2 sp 00007ffc244f7d90 error 4 in libmutter-12.so.0.0.0[7f874124d000+159000] likely on CPU 1 (core 0, socket 0)
[54220.627765] Code: f6 ff 66 0f 1f 44 00 00 e8 4b 0b f7 ff 0f b6 83 e5 02 00 00 eb 86 66 90 f3 0f 1e fa 55 48 89 e5 41 56 41 55 41 54 41 89 f4 53 <48> 8b 47 18 48 89 fb 4c 8b 6f 30 4c 8b b0 a0 01 00 00 48 8b 07 ff
Here’s the code of the extension:
const Main = imports.ui.main;
const PanelBox = Main.layoutManager.panelBox;
let _windowCreatedId;
function sleep(milliseconds) {
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
function enable() {
_windowCreatedId = global.display.connect('window-created', (d, win) => {
const [w, h] = global.display.get_size();
const top_bar_height = PanelBox.get_height();
if (win.can_maximize()) {
win.move_resize_frame(false, 0, top_bar_height, w / 2, h);
sleep(10).then(() => {
// Sometimes this seems needed to make the move
win.move_resize_frame(false, 0, top_bar_height, w / 2, h);
});
}
});
}
function disable() {
global.display.disconnect(_windowCreatedId);
}
Can anyone see what might be wrong with it in Wayland? By testing I’ve found it’s the move_resize_frame
calls that give the segfault.
Thank you very much in advance for any help!