[Bf-blender-cvs] [5c3b95e] master: FileBrowser: Fix some minor issue with fileentries creation.
Bastien Montagne
noreply at git.blender.org
Thu Aug 20 00:51:42 CEST 2015
Commit: 5c3b95e1a85a1ea14d5c4089f5117df28b12d906
Author: Bastien Montagne
Date: Thu Aug 20 00:48:59 2015 +0200
Branches: master
https://developer.blender.org/rB5c3b95e1a85a1ea14d5c4089f5117df28b12d906
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.
===================================================================
M source/blender/editors/space_file/filelist.c
===================================================================
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 1eb2a57..9b54ad6 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;
}
More information about the Bf-blender-cvs
mailing list