[Core] Workaround for Qt crappiness^W bug in #1399.

Qt's network caching is done in two stages: preparing a caching device for
an URL and inserting the prepared device to the cache. Meanwhile there also
is a function for removing an URL from the cache, which also invalidates
all the prepared devices.

For some reason Qt sometimes issues a call sequence like:
auto device = prepare(url);
remove(url); // this invalidates the device
insert(device); // here Qt accesses the devices and segfaults

The fun is that Qt actually tries to detect a dangling device pointer,
but for some reason logs the device on detection, causing the segfault
in logging.

The proposed solution in this commit introduces own storage of prepared
devices, so that we can keep track of the stall invalidated devices and
avoid calling to insert() at all.

So, this fixes #1399. I hope a bunch of ugly irreproducible segfaults
on some systems will be fixed by this.