diff options
author | Julian Eisel <julian@blender.org> | 2021-07-01 16:09:08 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-07-01 16:22:12 +0300 |
commit | 461717274091113112416d2733d4b44eacb57017 (patch) | |
tree | ee47bb00617538fb3f55d8692b5b0473a58da38f /source/blender/makesrna/intern/rna_space.c | |
parent | a112adf16a061b44297ec4f9dbb173be03891f5b (diff) |
Fix race condition when loading multiple File/Asset Browsers at once
When multiple File or Asset Browsers would load at once (e.g. when loading a
file with two File Browsers open) and they would load multiple directories or
.blend files (using the Recursions option in the File Browser or loading an
asset library with multiple .blends), often only one File/Asset Browser would
correctly load all files. Others would be incomplete or entirely empty. That
was because of a race condition, where the directories or .blend files would be
loaded concurrently and the first one that finished would cancel the other
ones. This again happened because they used the job system with the same
"owner", which by design makes all jobs with the same owner cancel as soon as
the first is finished.
Address this by making sure they have different owners. That is, not the scene
anymore, but the filelist the job belongs to. Doesn't make much sense to use
the scene as owner for scene-unrelated file loading anyway.
Steps to reproduce were:
* Open two File Browsers as regular editors.
* In the Display Settings popover, set "Recursions" to 2 or 3 levels.
* Navigate to a directory with plenty of subdirectories in both File Browsers.
* Save the file.
* Reload the file, one of the File Browsers likely has an incomplete file list.
Alternatively, use Asset Browsers and open an asset library containing multiple
.blends.
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d0a7e4aeea3..c8a779f890d 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2980,7 +2980,7 @@ static void rna_FileBrowser_FSMenu_active_range(PointerRNA *UNUSED(ptr), static void rna_FileBrowser_FSMenu_active_update(struct bContext *C, PointerRNA *ptr) { ScrArea *area = rna_area_from_space(ptr); - ED_file_change_dir_ex(C, (bScreen *)ptr->owner_id, area); + ED_file_change_dir_ex(C, area); } static int rna_FileBrowser_FSMenuSystem_active_get(PointerRNA *ptr) |