Tracker: Fix memory leak in IconCache::SetIcon.
How often this would have occurred before thumbnail support I'm not sure, but at least now that we have thumbnails, the icons are changed out with not insignificant frequency, especially on read-only filesystems.
This commit is contained in:
parent
a64cdd1dcc
commit
a173592b40
@ -292,18 +292,24 @@ void
|
||||
IconCacheEntry::SetIcon(BBitmap* bitmap, IconDrawMode mode, icon_size size,
|
||||
bool /*create*/)
|
||||
{
|
||||
BBitmap** icon = NULL;
|
||||
if (mode == kNormalIcon) {
|
||||
if (size == B_MINI_ICON)
|
||||
fMiniIcon = bitmap;
|
||||
icon = &fMiniIcon;
|
||||
else
|
||||
fLargeIcon = bitmap;
|
||||
icon = &fLargeIcon;
|
||||
} else if (mode == kSelectedIcon) {
|
||||
if (size == B_MINI_ICON)
|
||||
fHighlightedMiniIcon = bitmap;
|
||||
icon = &fHighlightedMiniIcon;
|
||||
else
|
||||
fHighlightedLargeIcon = bitmap;
|
||||
} else
|
||||
icon = &fHighlightedLargeIcon;
|
||||
}
|
||||
if (icon == NULL)
|
||||
TRESPASS();
|
||||
|
||||
if ((*icon) != NULL)
|
||||
delete *icon;
|
||||
*icon = bitmap;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user