Refresh of slow rendering documents causes segfault

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

Bug Description

Hi Adam, I use (experimental) daily builds and stumbled upon the following problem: Activating or deactivating either the new "spread tabs" or the new "Document title as tab title" setting when documents are opened causes a segfault. No problem occurs, if no documents are open. When starting from the terminal there is no message that gives a hint of the source of this problem.

I run debian unstable amd64 and use my homebrew experimental daily builds https://code.launchpad.net/~b-eltzner/+recipe/qpdfview-experimental-dailydeb but I do not really think, this is the source of the problem.

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

Hello Benjamin,

I tried but could not reproduce the effect using neither Qt 4 nor Qt 5. Could you try to reproduce the problem running a debugger to create a stack trace to find out where the segmentation fault originates?

Best regards, Adam.

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

Because if think we had this once, can you check that it is not just refreshing causing the segmentation fault and that it is really related to those settings? Thanks.

Revision history for this message
Benjamin Eltzner (b-eltzner) wrote :

Hi Adam, you are right. The problem only occurs for documents whose pages take very long to render. However, I don't quite get, why this problem should occur here. I would be glad if you could give me short explanation.

In the case of the file being changed on disk by another program, it is clear that trying to refresh, while the file is changed causes a segfault and qpdfview has no way to definitely determine, when the file is done being changed. So in that case I understand there is a problem of principle.

But here, the files are not changed on disk (and if qpdfview itself changes files on disk, I think it is quite possible to delay autorefresh during this time). So how does the autorefresh in this situation cause a segfault?

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

Hello again,

I don't auto-refresh is involved, it is just the usual refresh that happens after settings might have been changed, i.e. it is as if you clicked refresh in every open tab. Where that segmentation fault comes from, I don't know but I would guess some object life cycle is not handled correctly. In any case, it is hard to diagnose this without a stack trace.

Best regards, Adam.

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

So with the stack trace at, we found that is can happen that a RenderTask emits a signal after waking up other threads waiting for it which might have already destroyed it at that point. Hence we need to emit the signal before waking up people who might delete us....

Changed in qpdfview:
status: Incomplete → Confirmed
importance: Low → Medium
assignee: nobody → Adam Reichold (adamreichold)
milestone: none → 0.4.10
Changed in qpdfview:
status: Confirmed → Fix Committed
summary: - (De-)Activating "Spread Tabs" or "Document title as tab title" while
- documents are opened causes segfault
+ Refresh of slow rendering documents causes segfault
Revision history for this message
Benjamin Eltzner (b-eltzner) wrote :

Thanks for the fix and also for encouraging me to do my first multithreaded stack trace. :-)

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.