diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-08-20 01:48:59 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-08-20 01:51:21 +0300 |
commit | 5c3b95e1a85a1ea14d5c4089f5117df28b12d906 (patch) | |
tree | 9d505ae3e1733ae2362cfdc4c808d5e3d9dec27f /source/blender | |
parent | c11222e31a04dd9cb511d89f777da9871bf0b663 (diff) |
FileBrowser: Fix some minor issue with fileentries creation.
An entry could already exist in misc cache, when creating it for block cache, leading to double-creation.
Issue was not that serious (no memleak or so), but nasty still. Thanks to Severin for notifying the assert.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 1eb2a57b364..9b54ad65edc 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1574,9 +1574,14 @@ static bool filelist_file_cache_block_create(FileList *filelist, const int start int i, idx; for (i = 0, idx = start_index; i < size; i++, idx++, cursor++) { - FileDirEntry *entry = filelist_file_create_entry(filelist, idx); + FileDirEntry *entry; + + /* That entry might have already been requested and stored in misc cache... */ + if ((entry = BLI_ghash_popkey(cache->misc_entries, SET_INT_IN_POINTER(idx), NULL)) == NULL) { + entry = filelist_file_create_entry(filelist, idx); + BLI_ghash_insert(cache->uuids, entry->uuid, entry); + } cache->block_entries[cursor] = entry; - BLI_ghash_insert(cache->uuids, entry->uuid, entry); } return true; } |