KPixmapCache in kdelibs4support uses QDateTime in mmap'ed struct

Michael Pyne mpyne at kde.org
Tue Nov 3 00:56:51 UTC 2015


On Tue, November 3, 2015 00:40:58 Albert Astals Cid wrote:
> Someone went a bit too far in the "port away from time_t to QDateTime" and
> changed the timestamp member of the KPixmapCacheIndexHeader struct.
> 
> According to mpyne and thiago this is a big no-no.

The reason it's a big no-no is because KPixmapCacheIndexHeader is meant to be 
held and used from mmap()'d shared memory, which generally requires the use of 
plain old data (POD) types only, to avoid inadvertent constructor or 
destructor calls once the memory is freed.

QDateTime will (and is) leak applications to crash so I'd +1 the 
recommendation to change back to time_t (or at least some kind of integral 
type), and the type is internal-only so there's no API concern. Just don't 
forget to bump the defined KPIXMAPCACHE_VERSION so that old caches are flushed 
;).

Regards,
 - Michael Pyne


More information about the Kde-frameworks-devel mailing list