Tracker: Fix use-after-free on destruction of the icon caches.
The hash table member still uses the element array memeber to clear itself on destruction. We must therefore ensure that the element array isn't destroyed before the hash table. Since the destruction order of memebers is the reverse order of their declaration, reordering them is enough.
This commit is contained in:
parent
3fc2dd56db
commit
d0a9f6803b
@ -1408,13 +1408,13 @@ SharedIconCache::SharedIconCache()
|
||||
:
|
||||
#if DEBUG
|
||||
SimpleIconCache("Shared icon cache aka \"The Dead-Locker\""),
|
||||
fHashTable(20),
|
||||
fElementArray(20),
|
||||
fHashTable(20),
|
||||
fRetiredBitmaps(20, true)
|
||||
#else
|
||||
SimpleIconCache("Tracker shared icon cache"),
|
||||
fHashTable(1000),
|
||||
fElementArray(1024),
|
||||
fHashTable(1000),
|
||||
fRetiredBitmaps(256, true)
|
||||
#endif
|
||||
{
|
||||
@ -1765,12 +1765,12 @@ NodeIconCache::NodeIconCache()
|
||||
:
|
||||
#if DEBUG
|
||||
SimpleIconCache("Node icon cache aka \"The Dead-Locker\""),
|
||||
fHashTable(20),
|
||||
fElementArray(20)
|
||||
fElementArray(20),
|
||||
fHashTable(20)
|
||||
#else
|
||||
SimpleIconCache("Tracker node icon cache"),
|
||||
fHashTable(100),
|
||||
fElementArray(100)
|
||||
fElementArray(100),
|
||||
fHashTable(100)
|
||||
#endif
|
||||
{
|
||||
fHashTable.SetElementVector(&fElementArray);
|
||||
|
@ -262,8 +262,8 @@ public:
|
||||
void RemoveAliasesTo(int32 index);
|
||||
|
||||
private:
|
||||
OpenHashTable<SharedCacheEntry, SharedCacheEntryArray> fHashTable;
|
||||
SharedCacheEntryArray fElementArray;
|
||||
OpenHashTable<SharedCacheEntry, SharedCacheEntryArray> fHashTable;
|
||||
BObjectList<BBitmap> fRetiredBitmaps;
|
||||
// icons are drawn asynchronously, can't just delete them right away,
|
||||
// instead have to place them onto the retired bitmap list and wait
|
||||
@ -336,8 +336,8 @@ public:
|
||||
void RemoveAliasesTo(int32 index);
|
||||
|
||||
private:
|
||||
OpenHashTable<NodeCacheEntry, NodeCacheEntryArray> fHashTable;
|
||||
NodeCacheEntryArray fElementArray;
|
||||
OpenHashTable<NodeCacheEntry, NodeCacheEntryArray> fHashTable;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user