Fix crash, presumably since Qt 5.10?
ClosedPublic

Authored by apol on Dec 18 2017, 3:35 PM.

Details

Summary

We are opening the stream as read only and skipRawData would complain that
it's a write-only device, and skipping needs reading:
QIODevice::skip (QBuffer): WriteOnly device
It was a weird optimization anyway, so just pass the information like the
rest of the data and it works just fine.

BUG: 386364

Test Plan

The check on the bug report passes now, and akregator fetches
all feeds again.

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apol created this revision.Dec 18 2017, 3:35 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 18 2017, 3:35 PM
apol requested review of this revision.Dec 18 2017, 3:35 PM
anthonyfieroni added inline comments.
src/ioslaves/http/http.cpp
4910

I still can't understand why this call present? Doesn't work if it removed?

apol added inline comments.Dec 18 2017, 6:04 PM
src/ioslaves/http/http.cpp
4910

I understand that the serialised cache tag is part of the command and it's there at the beginning. Skip was so that we wouldn't write on top of it but append after.

anthonyfieroni added inline comments.Dec 18 2017, 6:56 PM
src/ioslaves/http/http.cpp
4910

Why not just seek ?

apol added inline comments.Dec 18 2017, 8:34 PM
src/ioslaves/http/http.cpp
4910

Why seek if this is essentially the same?
Actually, initialising the qbytearray and opening a stream over it then skipping its contents feels wrong.

anthonyfieroni added inline comments.Dec 19 2017, 5:52 AM
src/ioslaves/http/http.cpp
4910

Current implementation has a 4k buffer on the stack (from Qt source), patched one exclusive copy, seek is faster and cleaner.

apol updated this revision to Diff 24100.Dec 19 2017, 11:23 AM

Use QIODevice::skip instead

How does that remove the warning from QIODevice::skip, which we're now calling directly instead of indirectly? I don't get it.

I wonder if the bug is inside QIODevice::skip, which shouldn't CHECK_READABLE in all cases (only when it's going to fall back to reading).

Alternatively we could open the device in ReadWrite mode, no? That might make more sense, for a device that already has some data at the beginning.

apol updated this revision to Diff 24102.Dec 19 2017, 12:18 PM

Use QIODevice::ReadWrite

apol updated this revision to Diff 24103.Dec 19 2017, 12:22 PM

One change at a time

dfaure accepted this revision.Dec 19 2017, 10:34 PM
This revision is now accepted and ready to land.Dec 19 2017, 10:34 PM
This revision was automatically updated to reflect the committed changes.