Bug 496963

Summary: Qt program using layer-shell-qt exited after screen turn-off
Product: [Frameworks and Libraries] layer-shell-qt Reporter: Viet Dang <dangvd>
Component: generalAssignee: Aleix Pol <aleixpol>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Viet Dang 2024-12-02 22:15:20 UTC
SUMMARY

A Qt program using layer-shell-qt would exit itself if the screen is turned off.

It did not seem to crash, just exited by itself.

Minimal program below.

Could you please take a look?

Thanks,

Viet

—

Minimum program:

#include <QApplication>
#include <QWidget>
#include <QWindow>

#include <LayerShellQt/Window>

int main(int argc, char** argv) {
  QApplication app(argc, argv);

  QWidget dock;
  dock.winId();  // we need this for widget->windowHandle() to not return nullptr.
  auto* layerShellWin = LayerShellQt::Window::get(dock.windowHandle());

  // Same bug if for example this is called instead:
  // layerShellWin->setAnchors(LayerShellQt::Window::AnchorBottom);
  layerShellWin->setLayer(LayerShellQt::Window::LayerBottom);

  dock.show();

  return app.exec();
}


STEPS TO REPRODUCE
1. Build and run the program
2. Wait for screen to turn off (e.g. 1 minute of inactivity while screen is locked)
3. Reactivate screen

OBSERVED RESULT
Program exited itself.

EXPECTED RESULT
Program should stay alive.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: OpenSUSE Tumbleweed (also happens on Fedora 41, Kubuntu 24.10 etc.)
KDE Plasma Version: 6.2.2
KDE Frameworks Version: 6.7.0
Qt Version: 6.8.0

ADDITIONAL INFORMATION