[KPhotoAlbum] Crash in pixmapLoaded

Andreas Neustifter andreas.neustifter at gmail.com
Tue Dec 15 21:45:37 GMT 2015


okay this is complicated (to explain) and maybe the solution is too
compilcated but this is what was possible (for me) without a major

All the ImageRequest's that are handed to AsyncLoader return their results
by calling pixmapLoaded from the creating object.

My machine is quite slow and I have many videos in my library so when video
thumbnails are requestes from AsyncLoader (for e.g. the image merger) KPA
crashes reproducibly when the requesting object is deleted before the
request is processes because the request uses
request->client()->pixmapLoaded() to hand the result to a non-existent

My solution is to
1.) add the ability to mark a request as obsolete.

2.) use that information in to make sure requests are dropped/do not send
data when the request is obsolete.

3.) make sure all the objects creating ImageRequest's handle them properly:
 - NULL request pointer on construct
 - store pointer to request when creating it
 - NULL the request pointer when pixmapLoaded is called
 - when requestor is destroyed mark possibly open request as obsolete.

It would be cleaner to handle this with a shared_ptr to client in the
request but this would disrupt the code even more (I would have to make
sure that all objects creating the ImageRequest are heap-allocated as well.

Feedback, comments?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kphotoalbum/attachments/20151215/d784395b/attachment.htm>

More information about the Kphotoalbum mailing list