Under Wayland, QGuiApplication::nativeInterface() seems to return a null pointer. At least, this happens in Plasma 6.0.3 with Qt 6.6.2. A segmentation fault occurs when dereferencing the null pointer for obtaining the X11 display.
Checking for a valid pointer in x11Interface variable before acquiring the X11 display is safer and avoids this problem.
Under Wayland,
QGuiApplication::nativeInterface()
seems to return a null pointer. At least, this happens in Plasma 6.0.3 with Qt 6.6.2. A segmentation fault occurs when dereferencing the null pointer for obtaining the X11 display.Checking for a valid pointer in
x11Interface
variable before acquiring the X11 display is safer and avoids this problem.