Skip to content

Segfault on wayland #663

Open
Open
@lkzjdnb

Description

@lkzjdnb

Opening the application results on a segfault.

$ qtpass
util.cpp: 45 "/usr/local/texlive/2023/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/flutter/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin"
[1]    2011461 segmentation fault (core dumped)  qtpass
  • OS/Distribution: Arch Linux x86_64
  • Version : 1.4.0-1 and master

I believe the issue comes from wayland :
The line QCursor::pos() always return (0,0) and because it does not find a screen at this location it return NULL which causes the segfault down the line.
A simple fix I used was to add this line :

diff --git a/main/main.cpp b/main/main.cpp
index a8969b11..cf09685d 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -114,6 +114,7 @@ int main(int argc, char *argv[]) {
       app.desktop()->screenGeometry(cursorScreen).center();
 #else
   QScreen *screen = QGuiApplication::screenAt(QCursor::pos());
+  if(screen == NULL) screen = QGuiApplication::primaryScreen();
   QPoint cursorScreenCenter = screen->geometry().center();
 #endif
   QRect windowFrameGeo = w.frameGeometry();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions