mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
wrlib: Added clean-up of image cache in 'RShutdown'
The library maintains a cache of the images loaded, which is now emptyed when the lib is asked to shutdown.
This commit is contained in:
committed by
Carlos R. Mafra
parent
283286e0cd
commit
e237ec15a0
17
wrlib/load.c
17
wrlib/load.c
@@ -129,6 +129,23 @@ static void init_cache(void)
|
||||
}
|
||||
}
|
||||
|
||||
void RReleaseCache(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (RImageCacheSize > 0) {
|
||||
for (i = 0; i < RImageCacheSize; i++) {
|
||||
if (RImageCache[i].file) {
|
||||
RReleaseImage(RImageCache[i].image);
|
||||
free(RImageCache[i].file);
|
||||
}
|
||||
}
|
||||
free(RImageCache);
|
||||
RImageCache = NULL;
|
||||
RImageCacheSize = -1;
|
||||
}
|
||||
}
|
||||
|
||||
RImage *RLoadImage(RContext * context, const char *file, int index)
|
||||
{
|
||||
RImage *image = NULL;
|
||||
|
||||
Reference in New Issue
Block a user