[webkit-qt] Javascript inside pixeldata of QImage

Youri Westerman youri at pluxcustoms.nl
Tue Mar 19 08:40:16 PDT 2013


Hi Jocelyn,

So with following snippet:

QImage im(page->viewportSize(), QImage::Format_ARGB32);
QPainter painter(&im);

It would be possible to end up with an uninitialized QImage object? It
seems to me that I should get a segfault or something when I pass it
to the render method. Furthermore It is possible to call byteCount()
on it as well returning the correct number of bytes. I'll try calling
fill() on the object.

2013/3/19 Jocelyn Turcotte <jocelyn.turcotte at digia.com>:
> On Tue, Mar 19, 2013 at 04:08:45PM +0100, Youri Westerman wrote:
>> Thanks for your quick reply.
>> Actually I have extended the QWebPage class and overridden the
>> javascriptConsoleMessage method. All the javascript code does is wait
>> for a couple of seconds and then prints a console message. The thing
>> is that it works with qt4.8 and does not in qt5.
>>
>> However I would very much like to use qt4.8 at the moment because
>> there are no packages of qt5 available for ubuntu.
>>
>> Furthermore when I call the bits() method on a QImage painted through
>> the render method of QWebPage and inspect the data which was returned
>> there is javascript in there, while there should only be ARGB pixel
>> data... Seems like a bug to me, but maybe I'm doing something wrong?
>
> Hi,
>
> sorry, I misunderstood your issue.
>
> I find it is quite unlikely that render is writing JavaScript to your image.
> I think that QImage might not be initialized in your case, so that you are looking at uninitialized memory.
>
> So something must be going wrong and render isn't actually writing to the memory you are seeing, but I can't say much more by looking at your code snippet.
> Calling fill() on your QImage before render might help you investigate the issue at first.
>
> Cheers,
> Jocelyn



-- 
Youri Westerman
Developer

Pluxbox
Sumatralaan 45
Mediapark - Studio 21
t: 035-7606060
e: youri at pluxbox.nl
w: http://www.pluxbox.nl

Pluxbox


More information about the webkit-qt mailing list