Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-10-26 18:23:38 +0300
committerBastien Montagne <bastien@blender.org>2021-10-29 12:32:26 +0300
commit51c1c1cd938f990333b09d89fb063bb28864b302 (patch)
treed1533902832d1382ab0351b71c6621552ff3bb0f /source/blender/blenkernel/BKE_lib_query.h
parenteae59645def368a46c546a5d88db4b885f707b9b (diff)
Fix potential early-return in WM foreach_id process.
Add a function to check if iteration over ID usages should stop (using internal `IDWALK_STOP` status flag). Use it in `BKE_LIB_FOREACHID_PROCESS_` macros, and in `window_manager_foreach_id` to handle properly the active workspace case (previous code could skip the call to `BKE_workspace_active_set` in case iteration over ID usages was stopped by callback on that specific ID usage). Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.
Diffstat (limited to 'source/blender/blenkernel/BKE_lib_query.h')
-rw-r--r--source/blender/blenkernel/BKE_lib_query.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_lib_query.h b/source/blender/blenkernel/BKE_lib_query.h
index 957a623577e..093d3fb12a6 100644
--- a/source/blender/blenkernel/BKE_lib_query.h
+++ b/source/blender/blenkernel/BKE_lib_query.h
@@ -143,6 +143,7 @@ enum {
typedef struct LibraryForeachIDData LibraryForeachIDData;
+bool BKE_lib_query_foreachid_iter_stop(struct LibraryForeachIDData *data);
bool BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data,
struct ID **id_pp,
int cb_flag);
@@ -154,7 +155,8 @@ int BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeach
#define BKE_LIB_FOREACHID_PROCESS_ID(_data, _id, _cb_flag) \
{ \
CHECK_TYPE_ANY((_id), ID *, void *); \
- if (!BKE_lib_query_foreachid_process((_data), (ID **)&(_id), (_cb_flag))) { \
+ BKE_lib_query_foreachid_process((_data), (ID **)&(_id), (_cb_flag)); \
+ if (BKE_lib_query_foreachid_iter_stop((_data))) { \
return; \
} \
} \
@@ -163,7 +165,8 @@ int BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeach
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(_data, _id_super, _cb_flag) \
{ \
CHECK_TYPE(&((_id_super)->id), ID *); \
- if (!BKE_lib_query_foreachid_process((_data), (ID **)&(_id_super), (_cb_flag))) { \
+ BKE_lib_query_foreachid_process((_data), (ID **)&(_id_super), (_cb_flag)); \
+ if (BKE_lib_query_foreachid_iter_stop((_data))) { \
return; \
} \
} \