Skip to content
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

Segmentation fault when running examples on Wayland #40

Closed
marcusbritanicus opened this issue Jul 13, 2023 · 8 comments
Closed

Segmentation fault when running examples on Wayland #40

marcusbritanicus opened this issue Jul 13, 2023 · 8 comments

Comments

@marcusbritanicus
Copy link

marcusbritanicus commented Jul 13, 2023

All the examples crash when they are run inside a wayland compositor, such as weston and wayfire. The crash can be triggered by moving the mouse into the titlebar area. Sometimes, moving the mouse in any part of the window causes the crash.

Edit: Trying to run the examples in Xwayland (using -platform xcb switch) causes a black window to open along with the actual window. See screenshots below:

2023-07-13_23:13:46
2023-07-13_23:13:53

@antonypro
Copy link
Owner

@marcusbritanicus: Hi!

Forcing the xcb seems to solve nearly all problems on Ubuntu 22.04 and Ubuntu 20.04.

The black screen that you're seen maybe is the second window acting as resize borders, this window should be transparent, and it really is on the distros informed, both Xorg and Wayland.

Could you provide more info about the environment that you are testing it?

@marcusbritanicus
Copy link
Author

@antonypro Thanks for your response.

I'm using Wayfire. I have not tested on GNOME or KDE Plasma. If you need any other specific info, I can provide it.

@antonypro
Copy link
Owner

@marcusbritanicus: Could you please try version 2.4.1?

@marcusbritanicus
Copy link
Author

@antonypro I'm so sorry, but I've been unable to test the latest changes. I recently switched from Debian to Void, and am still getting used to it. Once I get the compilation working (overcome the strange errors that I did not encounter on Debian), I'll get back to you.

@marcusbritanicus
Copy link
Author

marcusbritanicus commented Sep 6, 2023

@antonypro I checked out the latest git. The examples continue to crash on Wayfire when run as wayland clients. However, when run as Xwayland clients, the black window has vanished. However, they appear in the panel as "Shadow". I know this is something that you probably cannot do anything about (just letting you know).

Another minor issue (more of a nitpik, really) is that the "Are you sure?" dialog does not have focus when it appears. I have to click it to make it have focus.

@marcusbritanicus
Copy link
Author

@antonypro Here is the backtrace generated by gdb:

Thread 1 "GoodShowCase" received signal SIGSEGV, Segmentation fault.
0x00007ffff715bb29 in XAddExtension () from /usr/lib/libX11.so.6
(gdb) 
(gdb) bt
#0  0x00007ffff715bb29 in XAddExtension () at /usr/lib/libX11.so.6
#1  0x00007ffff6f27fb6 in _XcursorGetDisplayInfo (dpy=dpy@entry=0x555555612030) at /usr/src/debug/libxcursor/libXcursor-1.2.1/src/display.c:132
#2  0x00007ffff6f2855e in XcursorSupportsARGB (dpy=dpy@entry=0x555555612030) at /usr/src/debug/libxcursor/libXcursor-1.2.1/src/display.c:290
#3  0x00007ffff6f2b5f9 in XcursorTryShapeCursor (dpy=0x555555612030, source_font=24, mask_font=24, source_char=134, mask_char=135, foreground=<optimized out>, background=0x7ffff71d9180) at /usr/src/debug/libxcursor/libXcursor-1.2.1/src/xlib.c:96
#4  0x00007ffff71513df in XCreateGlyphCursor () at /usr/lib/libX11.so.6
#5  0x00007ffff71562cc in XCreateFontCursor () at /usr/lib/libX11.so.6
#6  0x0000555555579721 in QGoodWindow::setCursorForCurrentPos() (this=0x7fffffffdb10) at /home/cosmos/QGoodWindow/QGoodWindow/QGoodWindow/src/qgoodwindow.cpp:3692
#7  0x0000555555579249 in QGoodWindow::eventFilter(QObject*, QEvent*) (this=0x7fffffffdb10, watched=0x555555904350, event=0x7fffffffd390) at /home/cosmos/QGoodWindow/QGoodWindow/QGoodWindow/src/qgoodwindow.cpp:2092
#8  0x00007ffff5c99442 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#9  0x00007ffff697892f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#10 0x00007ffff697ddef in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#11 0x00007ffff5c9c438 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#12 0x00007ffff697c12a in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /usr/lib/libQt5Widgets.so.5
#13 0x00007ffff69cced5 in  () at /usr/lib/libQt5Widgets.so.5
#14 0x00007ffff69cec27 in  () at /usr/lib/libQt5Widgets.so.5
#15 0x00007ffff697893f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#16 0x00007ffff5c9c438 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#17 0x00007ffff614193c in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/libQt5Gui.so.5
#18 0x00007ffff612a6c5 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Gui.so.5
#19 0x00007ffff495ec25 in  () at /usr/lib/libQt5WaylandClient.so.5
#20 0x00007ffff74f7a61 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#21 0x00007ffff7554c29 in  () at /usr/lib/libglib-2.0.so.0
#22 0x00007ffff74f5112 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#23 0x00007ffff5ceb25c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#24 0x00007ffff5c9b144 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#25 0x00007ffff5c9c5e3 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#26 0x000055555556a5e3 in main(int, char**) (argc=1, argv=0x7fffffffdd48) at /home/cosmos/QGoodWindow/QGoodWindow/Examples/GoodShowCase/main.cpp:37

The problem seems to arise in QGoodWindow::setCursorForCurrentPos(), line 3670 of qgoodwindow.cpp
Despite being in wayland, you're trying to use X11 functions. For example, Line 3683: QX11Info::display() or Line 3692: XCreateFontCursor(...) This is what is causing the crash.

@antonypro
Copy link
Owner

@marcusbritanicus: Hi!

QGoodWindow is very dependent of X11 when running on Linux, so Xwayland is the expected way to use the library on Linux with Wayland as communication protocol.

The "Shadow" windows that you see are used as resize areas on Linux, and appears on taskbar depending on current desktop environment, I've tried to hide it for any desktop environment, without success.

About the QMessageBox shown without focus it should not occurs because on Linux QGoodWindow is a regular frame less QMainWindow, and i don't think this is a mistake from my side.

I think this covers the issues you've pointed here, if you still in doubt, please keep asking.

Thanks!

@marcusbritanicus
Copy link
Author

QGoodWindow is very dependent of X11 when running on Linux, so Xwayland is the expected way to use the library on Linux with Wayland as communication protocol.

I know. It's sad that it won't work as a native client.

The "Shadow" windows that you see are used as resize areas on Linux, and appears on taskbar depending on current desktop environment, I've tried to hide it for any desktop environment, without success.

There is no generic way, at least not while running in Wayland. However, on X11/XCB you can set the _NET_WM_STATE_SKIP_TASKBAR state and X11 window manager should respect that. Currently, there is no protocol that can indicate

I think I'll close this issue here. Nothing much we can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants