[KPhotoAlbum] Problems in my port to look out for
Jesper K. Pedersen
blackie at blackie.dk
Sun Jul 29 19:19:47 BST 2007
I just realized I did some pretty stupid thing when porting to KDE4, so here
is something to look out for when you debug the KDE 4 version of KPA, and
esp. when you see crashes due to pointers already being deleted.
Lots of places in the API there are DB::CategoryItemPtr and similar Ptr
classes used. This is a reference counted version, that will delete the
wrapped DB::CategoryItem* when the last instance of the Ptr class goes out of
scope.
In KDE 3 I could give a CategoryItemPtr to a function that expected a
CategoryItem* and it would itself extract the pointer. This doesn't work with
KDE 4. I therefore unfortunately replaced the function parameter from
CategoryItem* to CategoryItemPtr, which suddanly added reference counting and
in the end deletion to a pointer that should not be.
The real solution was of course to call the data() method on the
CategoryItemPtr instance to extract the pointer.
Cheers
Jesper.
--
Having trouble finding a given image in your collection containing
thousands of images?
http://www.kphotoalbum.org might be the answer.
More information about the Kphotoalbum
mailing list