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

Segfault on wayland #663

Open
lkzjdnb opened this issue Sep 27, 2023 · 1 comment
Open

Segfault on wayland #663

lkzjdnb opened this issue Sep 27, 2023 · 1 comment
Labels

Comments

@lkzjdnb
Copy link

lkzjdnb commented Sep 27, 2023

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();
@lkzjdnb lkzjdnb added the bug label Sep 27, 2023
@MR-KO
Copy link

MR-KO commented Oct 19, 2023

one quick alternative for regular users (non-devs), without having to adjust code and recompile, is to add an environment variable on launch (you can also set this graphically using KDE/Gnome):

QT_QPA_PLATFORM=xcb qtpass

You'll need XWayland, but on most distros that will likely be present. If not, you can install it if necessary, or wait for the fix. Or use the normal pass CLI program.

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

No branches or pull requests

2 participants