Use of Boost library classes in kdecore?
koos vriezen
koos.vriezen at gmail.com
Fri Jul 6 22:42:39 BST 2007
2007/7/6, David Jarvie <lists at astrojar.org.uk>:
[..]
> The reason reference counted pointers are necessary is to prevent users of
> KTimeZone instances from referencing invalid pointers if the KTimeZone
> instance happens to get deleted somewhere else. This problem has already
> arisen when iCalendar files are reloaded in kdepimlibs/kcal - KDateTime
> objects which reference a time zone require that the KTimeZone instance
> doesn't disappear. It is unrealistic to expect developers in general to be
> sufficiently aware of the issue to manage to avoid it. The problem might only
> manifest itself occasionally, and it is not necessarily easy to track down.
> Use everywhere of a KTimeZonePtr class in place of KTimeZone pointers would
> fix this:
You have then two different pointers to the same timezone?
How about adding a comment:
// Note the KTimeZone pointerr becomes invalid when you call reload
Btw. how many timeszones are there anyhow?
> typedef shared_ptr<KTimeZone> KTimeZonePtr;
Note that this may add other headaches like a pointer ending in two
shared pointers and the KTimeZone unaware of its own shared_ptr.
Koos
More information about the kde-core-devel
mailing list