首页| 论坛| 消息
主题:qt5 多线程下载 QNetworkReply readAll后程序崩溃 [
回帖:chenjun0211:QByteArray tempArry = reply->readAll();改写成QByteArray tempArry = reply->read(reply->bytesAvailable());这样试试
小文件用readAll应该是没问题的,大文件传输不能一次完成,可能是这样的原因 (2014-04-12 16:58) 
我试过你说的这种方法了,还是不行,大文件下载程序直接是异常中止,没有报错,多个小文件同时下载就会报错,如下:
*** Error in `/home/yang/QtWorkSpace/PolarBearDownload/build-PolarBearDownload-Desktop_Qt_5_2_0_GCC_64bit-Release/PolarBearDownload': double free or corruption (!prev): 0x00007fb700007860 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7fb7846dfa46]
/usr/lib/nvidia-304/tls/libnvidia-tls.so.304.116(+0x1cd1)[0x7fb7825f2cd1]
======= Memory map: ========
00400000-00467000 r-xp 00000000 08:0e 2370542/home/yang/QtWorkSpace/PolarBearDownload/build-PolarBearDownload-Desktop_Qt_5_2_0_GCC_64bit-Release/PolarBearDownload
00667000-00669000 r--p 00067000 08:0e 2370542/home/yang/QtWorkSpace/PolarBearDownload/build-PolarBearDownload-Desktop_Qt_5_2_0_GCC_64bit-Release/PolarBearDownload
00669000-0066a000 rw-p 00069000 08:0e 2370542/home/yang/QtWorkSpace/PolarBearDownload/build-PolarBearDownload-Desktop_Qt_5_2_0_GCC_64bit-Release/PolarBearDownload
00dde000-016fc000 rw-p 00000000 00:00 0
40808000-4080a000 r-xs 00000000 08:0e 146215 /tmp/glWq3BOe (deleted)
40c94000-40d12000 rw-p 00000000 00:00 0
下一楼›:此问题已经解决
原因是reply跟manager这两个对象是在run函数中new出来的,按照Qt官方的说法 ..
‹上一楼:好的,我现在试试,非常感谢

查看全部回帖(9)
«返回主帖