Bug 321212

Summary: Middle mouse pressing in a form makes the rendering go crazy
Product: [Applications] okular Reporter: Jaime Torres <jtamate>
Component: PDF backendAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: aacid
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.0
Sentry Crash Report:
Attachments: the screenshot
a sample calligra words text that makes the trick for me.
the pdf file for posterity

Description Jaime Torres 2013-06-16 07:40:58 UTC
Using a PDF with forms, like http://www.bankia.com/recursos/doc/corporativo/20130417/preferentes/formulario-de-solicitud-para-acudir-al-arbitraje-de-preferentes-y-deuda-subordin.pdf
I have the text edited in calligra words, just copy/paste a long text to the big text form in the pdf, and the render goes crazy, just move around the pdf. If this does not happen the first copy/paste, repeat 2 or 3 times.

Reproducible: Always

Steps to Reproduce:
1. open a pdf with forms
2. fill the forms using copy/paste (especially if the copied text has bold/underscore....
3. show/hide forms and move around the pdf
Comment 1 Jaime Torres 2013-06-16 07:42:22 UTC
I forgot, Zooming the document also helps.
Comment 2 Albert Astals Cid 2013-06-16 11:22:02 UTC
Can you provide a screenshto of the "crazy" effect? Also if you could provide the document you're using to copy&paste it'd be great, i tried and could not reproduce any weirdness.
Comment 3 Jaime Torres 2013-06-16 12:05:44 UTC
Created attachment 80549 [details]
the screenshot

After pasting, just look around the document...
Comment 4 Jaime Torres 2013-06-16 20:42:22 UTC
Probably related to this valgrind error (reproduced under valgrind):

==15562== Mismatched free() / delete / delete []
==15562==    at 0x4C2AA9C: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15562==    by 0x1D358B8C: TextStringToUCS4(GooString*, unsigned int**) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D37D029: ActualText::end(GfxState*) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D3046E0: Gfx::opEndMarkedContent(Object*, int) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D305EC3: Gfx::go(bool) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D30632F: Gfx::display(Object*, bool) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D347CAB: Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1CFCAED9: Poppler::Page::textList(Poppler::Page::Rotation) const (in /usr/lib64/libpoppler-qt4.so.4.2.0)
==15562==    by 0x1CD1D380: PDFGenerator::textPage(Okular::Page*) (generator_pdf.cpp:1047)
==15562==    by 0x17037AC1: Okular::TextPageGenerationThread::run() (generator_p.cpp:103)
==15562==    by 0x7247130: QThreadPrivate::start(void*) (qthread_unix.cpp:338)
==15562==    by 0x76B7E0D: start_thread (in /lib64/libpthread-2.17.so)
==15562==  Address 0x12e87c40 is 0 bytes inside a block of size 4 alloc'd
==15562==    at 0x4C2B537: operator new[](unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15562==    by 0x1D358B49: TextStringToUCS4(GooString*, unsigned int**) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D37D029: ActualText::end(GfxState*) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D3046E0: Gfx::opEndMarkedContent(Object*, int) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D305EC3: Gfx::go(bool) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D30632F: Gfx::display(Object*, bool) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1D347CAB: Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*) (in /usr/lib64/libpoppler.so.37.0.0)
==15562==    by 0x1CFCAED9: Poppler::Page::textList(Poppler::Page::Rotation) const (in /usr/lib64/libpoppler-qt4.so.4.2.0)
==15562==    by 0x1CD1D380: PDFGenerator::textPage(Okular::Page*) (generator_pdf.cpp:1047)
==15562==    by 0x17037AC1: Okular::TextPageGenerationThread::run() (generator_p.cpp:103)
==15562==    by 0x7247130: QThreadPrivate::start(void*) (qthread_unix.cpp:338)
==15562==    by 0x76B7E0D: start_thread (in /lib64/libpthread-2.17.so)
Comment 5 Albert Astals Cid 2013-06-16 21:00:58 UTC
Not really, that error can't cause anything like what you're seeing.

Still waiting for the file you copy&paste from, since copy&paste from kate does not caus any weirdness here.
Comment 6 Jaime Torres 2013-06-17 06:50:44 UTC
Created attachment 80574 [details]
a sample calligra words text that makes the trick for me.

What I do: Just select all the text with the mouse, then paste it in the pdf with the middle mouse, then move within the pdf using the scrollbars.
Comment 7 Albert Astals Cid 2013-06-23 16:14:25 UTC
This is weird, it happens only if you paste with the middle mouse but not if you Ctrl+V

Can you confirm that?
Comment 8 Albert Astals Cid 2013-06-23 16:16:28 UTC
Created attachment 80735 [details]
the pdf file for posterity
Comment 9 Jaime Torres 2013-06-23 20:09:39 UTC
Yes, I can confirm it only happens with the middle mouse.
Comment 10 Christoph Feck 2013-07-11 22:59:28 UTC
If I understand the discussion correctly, this bug should be marked confirmed?
Comment 11 Albert Astals Cid 2013-07-14 23:46:13 UTC
Right
Comment 12 Albert Astals Cid 2013-08-05 21:50:21 UTC
Updated the title to reflect that is not only big texts that make it go crazy, they help, but any middle mouse paste makes the thing go crazy for me
Comment 13 Albert Astals Cid 2013-08-06 20:02:02 UTC
Git commit 45dc1990ebca66c2529bf7dd206a9862ade2dd0e by Albert Astals Cid.
Committed on 06/08/2013 at 20:01.
Pushed by aacid into branch 'KDE/4.11'.

Don't keep track of middle mouse press in a variable

This fixes the rendering problem in 321212. Why? Because what was happening is that for some reason the middle mouse press to gets to the PageView but not the release, this meant that the PageView got stuck into mouseMidZooming mode and all sort of bad things happened. Now since we don't cache if the mid mouse button is pressed (we just query it when needed) everything is better.

Ideally i'd like to know why we get the press and not the release, but not sure that's feasible to "fix".
REVIEW: 111901
FIXED-IN: 4.11.0

M  +5    -9    ui/pageview.cpp

http://commits.kde.org/okular/45dc1990ebca66c2529bf7dd206a9862ade2dd0e