Fix: Deadlock when generating asset catalog tree after file-load

Partial fix for #130007.

The catalog tree mutex would be set in `catalog_tree()` and
`invalidate_catalog_tree()`. The former could end up adding catalogs and thus
calling `invalidate_catalog_tree()`, which would attempt to set a mutex that the
caller set already. This seems like a good use-case for `std::recursive_mutex`.

would make sure there's a catalog for each catalog path by calling
`create_missing_catalogs()`
This commit is contained in:
Julian Eisel
2025-02-05 12:45:58 +01:00
committed by Julian Eisel
parent 861d53cb41
commit 50f7666785

View File

@@ -45,7 +45,7 @@ class AssetCatalogService {
* Cached catalog tree storage. Lazy-created by #AssetCatalogService::catalog_tree().
*/
std::unique_ptr<AssetCatalogTree> catalog_tree_;
std::mutex catalog_tree_mutex_;
std::recursive_mutex catalog_tree_mutex_;
Vector<std::unique_ptr<AssetCatalogCollection>> undo_snapshots_;
Vector<std::unique_ptr<AssetCatalogCollection>> redo_snapshots_;