diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-18 17:45:52 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-18 19:16:33 +0300 |
commit | 614a0a47e59a648a3bb7ba7b55b417a5faa730ba (patch) | |
tree | 9834732f77d63218a7bc9fae689f85229cbb38ce /source/blender/blenkernel/BKE_main.h | |
parent | 28901820a4494d5bd6700b2cc664f0a2d98c7411 (diff) |
BKE_main: make FOREACH new macros working when deleting some IDs.
Diffstat (limited to 'source/blender/blenkernel/BKE_main.h')
-rw-r--r-- | source/blender/blenkernel/BKE_main.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 6821ec1c5ee..cd17d84651c 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -143,9 +143,13 @@ struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset); /* *** Generic utils to loop over whole Main database. *** */ #define FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id) \ - for (_id = _lb->first; _id != NULL; _id = _id->next) { \ + { \ + ID *_id_next = _lb->first; \ + for (_id = _id_next; _id != NULL; _id = _id_next) { \ + _id_next = _id->next; #define FOREACH_MAIN_LISTBASE_ID_END \ + } \ } ((void)0) @@ -154,7 +158,7 @@ struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset); ListBase *_lbarray[MAX_LIBARRAY]; \ int i = set_listbasepointers(_bmain, _lbarray); \ while (i--) { \ - FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[i], _id) \ + FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[i], _id) #define FOREACH_MAIN_ID_END \ FOREACH_MAIN_LISTBASE_ID_END; \ |