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

[Linux] maximizing and restoring the Notes window freezes / hangs the application #611

Closed
moritz1000 opened this issue Jul 28, 2023 · 14 comments

Comments

@moritz1000
Copy link

I am using Arch Linux & KDE.

Recording.Notes.mp4

Steps to reproduce:

  1. Maximize Notes
  2. Restore Notes to the original size

-> Freeze / Hang
-> Can't interact with the window anymore / type something

You need to kill the application and restart it in order to use it again.


It does not matter whether I am using the "use native window frame" option or not.

@zjeffer
Copy link
Collaborator

zjeffer commented Jul 28, 2023

Hi, thanks for reporting. This is a known issue but we forgot to create an issue for this.

The problem is somewhere in the newest Qt version (6.5), because the problem does not appear on Qt 6.4.3. We created a bug report here: https://bugreports.qt.io/browse/QTBUG-115459.

An alternative for you is to use the appimage instead, until this bug is fixed.

@moritz1000
Copy link
Author

moritz1000 commented Jul 28, 2023

An alternative for you is to use the appimage instead, until this bug is fixed.

Thank you for the workaround.


I guess this should be another bug report but I just want to point out that your AppImage is not playing nicely with AppImageLauncher.
I use AppImageLauncher with all my other AppImages without any problems.

In the case of Notes I had to uninstall AppImageLauncher & restart my system in order for the Notes AppImage to launch.

EDIT: Can't reproduce since I can't get AppImageLauncher to work again, broke it while troubleshooting. The last release of AppImageLauncher was Sep 29, 2020 so maybe that's the problem.

@nuttyartist
Copy link
Owner

@moritz1000 Can you please open a new issue for this problem?

@guihkx
Copy link
Collaborator

guihkx commented Jul 28, 2023

This one also affects Windows, by the way.

Another alternative to Linux users is to use the Flatpak version, which still uses Qt 6.4.

But yeah, this is a pretty annoying one. :(

@guihkx
Copy link
Collaborator

guihkx commented Sep 5, 2023

I think I found a consistent way to trigger/prevent the freezing.

Steps to force the app to freeze:

  1. Exit Notes

  2. Open Settings.ini with a text editor

  3. Replace the entire windowGeometry line by this:

    windowGeometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x1\x96\0\0\0\xa3\0\0\x5\xe7\0\0\x3u\0\0\x1\x96\0\0\0\xc0\0\0\x5\xe7\0\0\x3u\0\0\0\0\0\0\0\0\a\x80\0\0\x1\x96\0\0\0\xc0\0\0\x5\xe7\0\0\x3u)
  4. Save the file

  5. Open Notes

  6. Select/Create a note that's not empty

  7. Maximizing/restoring the window should freeze the app

Steps to prevent the app from freezing:

  1. Exit Notes

  2. Open Settings.ini with a text editor

  3. Replace the entire windowGeometry line by this:

    windowGeometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x1#\0\0\0\xe5\0\0\x6\"\0\0\x3\x96\0\0\x1#\0\0\x1\x2\0\0\x6\"\0\0\x3\x96\0\0\0\0\0\0\0\0\a\x80\0\0\x1#\0\0\x1\x2\0\0\x6\"\0\0\x3\x96)
  4. Save the file

  5. Open Notes

  6. Select/Create a note that's not empty.

  7. Maximizing/restoring the window should not freeze the app

I haven't looked into what these values mean yet, but these steps have worked on my Linux machine, but it'd be good to get another confirmation on this... Additionally, and unfortunately, I still haven't found a way to reproduce this with a minimal example so we can report it to Qt devs. =(

If you're going to test this, just remember to do it with a Qt 6.5.x build. This is not reproducible with any of the official binaries we release, since they still use Qt 6.4.x.

@nuttyartist
Copy link
Owner

I haven't tested this yet, have you tried printing the window geometry to see if there's anything unusual with the problematic one?

@guihkx
Copy link
Collaborator

guihkx commented Sep 5, 2023

No yet, no. I'll definitely look into that though - unless someone beats me to it.

@guihkx
Copy link
Collaborator

guihkx commented Jan 11, 2024

I forgot to post an update on this, but in short:

I reported this upstream, and I also managed to create a minimal, reproducible example that triggers the bug only with Qt 6.5+, but unfortunately there hasn't been an official follow up yet.

Instead of waiting on upstream, perhaps we can find a workaround in our code base instead...

If someone wants to give this a look, essentially, the app freezes in CustomDocument::setDocumentPadding(), after calling QAbstractScrollArea::setViewportMargins().

The call stack looks basically like this:

  1. We listen for the window resize event here
  2. We call MainWindow::setCurrentFontBasedOnTypeface() here
  3. We call MainWindow::alignTextEditText() here
  4. We call MainWindow::setupTextEditStyleSheet() here
  5. We call CustomDocument::setDocumentPadding() here
  6. We call setViewportMargins() here <-- Freezing occurs

@nuttyartist
Copy link
Owner

nuttyartist commented Jan 13, 2024

Weird... I can't reproduce this on Windows 10 with Qt 6.5.2 MinGW 64bit.

EDIT: nor with Qt 6.6.1 on Windows 10.

@guihkx
Copy link
Collaborator

guihkx commented Jan 13, 2024

@nuttyartist Did you try reproducing it with default settings? And with actual text inside the textEdit widget?

Also, can you try reproducing it with this small project?

Just build it as usual (cmake -B build && cmake --build build), run the program, and simply maximize and unmaximize the window.

It should freeze after that...

@nuttyartist
Copy link
Owner

Did you try reproducing it with default settings? And with actual text inside the textEdit widget?

Yes, straight from master. And yes, with some text.

Also, can you try reproducing it with this small project?

Yes, this one hangs.

Weird.

@nuttyartist
Copy link
Owner

bug.mp4

@guihkx
Copy link
Collaborator

guihkx commented Jan 30, 2024

Good news: This bug has been fixed in Qt 6.6.3!

I'll leave this open until 6.6.3 is released, which should be at the end of February, and then we can upgrade our official packages to use that version.

EDIT: Qt 6.6 release plan: https://wiki.qt.io/Qt_6.6_Release

guihkx added a commit to guihkx/io.github.nuttyartist.notes that referenced this issue Apr 7, 2024
This update is long overdue, but it was being postponed on purpose, to
avoid triggering this bug:

nuttyartist/notes#611

That bug has been fixed in Qt 6.6.3, so now we can update.
@guihkx
Copy link
Collaborator

guihkx commented May 22, 2024

Qt 6.6.3 has been out for quite a while now, and since the v2.2.1 binaries we distribute still use Qt 6.4 (where this issue is not present), I think we can close this.

@guihkx guihkx closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants