qpdfview freezes trying to trim margins

Bug #1970113 reported by thedoctar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qpdfview
Fix Released
Medium
Adam Reichold

Bug Description

I use the “trim margins” option. When the screen area showing the PDF page matches the trimmed page very close, qpdfview freezes, as it keeps trying to adjust the PDF page. You can reproduce the bug by:
    1. Open any PDF
    2. Open a dock (e.g. press F6), such that it is in vertical alignment (so that its size is is adjusted by changing its horizontal width).
    3. Adjust the dock's width to exactly match the page width.
    4. qpdfview will constant try and adjust the PDF page margins because it is confused by the screen area border.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hallo,

thank you for taking the time to report this. I was not yet able to reproduce this based on your description. Could you add which view mode (fit to width? continuous?) you are using and the versions involved (of qpdfview and Qt)?

Regards,
Adam

Changed in qpdfview:
status: New → Incomplete
Revision history for this message
thedoctar (thedoctar) wrote :

Hi,

Sorry I should have said so earlier. I'm *not* using continuous mode (Ctrl+7) and am using fit to width (Ctrl+9), but the bug is independent of whether I use fit to page or width.

My qpdfview version is 0.4.18 and I think I'm using QT 5.12.8; here are some relevant dependencies:

libqt5concurrent5 5.12.8+dfsg-0ubuntu2.1
libqt5core5a 5.12.8+dfsg-0ubuntu2.1
libqt5dbus5 5.12.8+dfsg-0ubuntu2.1
libqt5gui5 5.12.8+dfsg-0ubuntu2.1
libqt5network5 5.12.8+dfsg-0ubuntu2.1
libqt5printsupport5 5.12.8+dfsg-0ubuntu2.1
libqt5sql5 5.12.8+dfsg-0ubuntu2.1
libqt5sql5-sqlite 5.12.8+dfsg-0ubuntu2.1
libqt5svg5 5.12.8-0ubuntu1
libqt5widgets5 5.12.8+dfsg-0ubuntu2.1
libqt5xml5 5.12.8+dfsg-0ubuntu2.1
qpdfview 0.4.18-1build1 [modified: usr/share/applications/qpdfview.desktop]
qpdfview-djvu-plugin 0.4.18-1build1
qpdfview-ps-plugin 0.4.18-1build1
qpdfview-translations 0.4.18-1build1
qt5-gtk-platformtheme 5.12.8+dfsg-0ubuntu2.1
qttranslations5-l10n 5.12.8-0ubuntu1

My modified desktop file is due to the fact that I have a global QT_SCALE_FACTOR=1.1 BUT I set QT_SCALE_FACTOR=1 when using qpdfview.

Revision history for this message
thedoctar (thedoctar) wrote :

I get this bug with this document: https://pdg.lbl.gov/2021/reviews/rpp2021-rev-phys-constants.pdf

Can you reproduce it?

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

I tried using Qt version 5 and was yet unable to do so. I also tried the document you linked now which did not change things for me.

One thing to try to ensure that I am not chasing ghosts would be for you to give the latest trunk version a try to see if the issue is still present in the latest code. For example using the dailydebs from [1]. (They should be quite stable despite the warning.)

If the issue does persist, maybe you could create a short screen recording of you triggering the bug? I fear I might not be following your instructions correctly.

Regards,
Adam

[1] https://code.launchpad.net/~adamreichold/+archive/ubuntu/qpdfview-dailydeb

Revision history for this message
thedoctar (thedoctar) wrote :

I uploaded a video here: https://bwsyncandshare.kit.edu/s/is5fREkgJspBqEo

I have a sneaking suspicion that the bug might be related to my font antialiasing preferences: https://bwsyncandshare.kit.edu/s/wNijt8MyedgwHT4

Revision history for this message
Adam Reichold (adamreichold) wrote :

Was finally able to reproduce it. Will investigate further.

thedoctar (thedoctar)
Changed in qpdfview:
status: Incomplete → Confirmed
Revision history for this message
Adam Reichold (adamreichold) wrote :

For me this seems to happen when the vertical switches between visible and invisible.

Changed in qpdfview:
status: Confirmed → Triaged
importance: Undecided → Medium
Revision history for this message
Adam Reichold (adamreichold) wrote :

The problem appears to be unrelated to trimming the margins and can be triggered with that option enabled, even though it is slightly harder.

I think what happens is:
1. the scroll bar becomes visible, triggering a relayout due to fit-to-width
2. updating the page geometries with a smaller scale factor will make the QScrollArea hide the scroll bar
3. hiding the scroll bar triggers a relayout due to fit-to-width
4. updating the page geometries with a large scale factor will make the QScrollArea show the scroll bar
1. ...

Revision history for this message
Adam Reichold (adamreichold) wrote (last edit ):

I pushed a tentative fix - always consider the space requirements of scroll bars even if currently hidden when scaling to fit - as trunk revision 2139 which should hit the dailydebs in an hour or so. (I just triggered the build but it will take until updated packages are available via the PPA.)

Could you give those a try? Thank you!

Changed in qpdfview:
status: Triaged → Fix Committed
assignee: nobody → Adam Reichold (adamreichold)
milestone: none → 0.5.0
Revision history for this message
thedoctar (thedoctar) wrote :

Wow, I will do that! This is the first bug that I've fixed helped fix from start to finish. I feel proud :)

Revision history for this message
thedoctar (thedoctar) wrote :

I just got the update; qpdfview is now fixed!! Yay!

Revision history for this message
Adam Reichold (adamreichold) wrote :

Thank you for following up on this! Made qpdfview a little better for all of its users. Sorry that it took so long to build the update. Apparently, there was an issue with the Launchpad build farm not making sufficient progress.

Changed in qpdfview:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.