[KPhotoAlbum] PATCH: remove some ImageRequest memory leaks

Henner Zeller h.zeller at acm.org
Tue May 1 01:37:40 CEST 2007


Hi,
While looking into the ImageManager (with the help of the LeakTracer
[1]), I found some memory leaks that add up over time: ImageRequests
were not deleted in certain circumstances:
  - when adding a request that already is in the queue:
RequestQueue::addRequest()
  - cancelled requests: RequestQueue::cancelRequests()
  - requests that are just the same as the one currently loading and
thus are discarded Manager::loadImage()

In the course of that, I did some small re-arrangements of code in the
ImageManager::Manager and fixed what I believe is a bug in
ImageManager::Manager::loadImage():

  -    if ( _currentLoading && *_currentLoading == *request &&
_loadList.isRequestStillValid( request ))
  +    if ( _currentLoading && *_currentLoading == *request &&
_loadList.isRequestStillValid( _currentLoading ))

The list was checked if the just passed request was in there (which it
isn't of couse) instead of the _currentLoading one.

As usual to be found here:
  http://vicdor.org/kpatches/#remove-image-request-memleaks

cheers,
  -henner

[1] http://www.andreasen.org/LeakTracer/


More information about the KPhotoAlbum mailing list