Unsolved Recent assertions during simultaneous download data from web
-
Hi.
i develop cross-platform application which gets about 50 files, results are displayed in two slideshows on screen. I use two instances of non-threaded downloader each for one slide, then readed bytearray is stored in array. i made 6 slots for all downloads in parent class, which manages tasks for both downloaders.
After every finished download, one slot is freed and new download begins, depending of next in queue.
The main problem is, when i get data - bytearray is created and its reference is send by signal to other class, where it is covnerted to Qimage and goes on, Application crashes sometimes when bytearray is converted to image by QImage::FromData , also tried QPixmap.loadFormData.
When i qdebug data (left 100 bytes and right 100) - there are valid headers and tails of PNG format, i provided delays after each download - 1000msecs - no difference. It doesnt matter when i download data from network or cache, application crashes during conversion, debugger tells me that reason is "unknown" so - maybe someone bothered with similiar issue? thanks for advice. -
Hi,
Are you properly waiting that the finished signal is called before processing the data you downloaded ?
-
@SGaist Yes, finished signal is connected to proper function, i got data, because its always PNG file, i also check first 8 bytes and last bytes for proper file format, i also check header's pairs for stored file length ant format, also compare retrieved data length with value stored in header, everythinhg looks fine, BOOM apppears during conversion from QByteArray to QImage (QImage::loadFromData)
-
Then write out the received data into a file and see if it can be read with a painting program.
-
@Christian-Ehrlicher - yes i thought about it - thank You - i think also about reimplement conversion, once I used QImageWriter i don't know yet what's the difference between QImage: conversion and QImagewriter writing to QBuffer maybe its more complex and format-issues-error-proof :)
-
There is no difference between QImage and QImageWriter wrt the image format handling. Just write out the QByteArray into a QFile and take a look with another program.