Fixed creative.lua invalidating iterator in loop #4354

Merged
the-real-herowl merged 2 commits from it_inval_fix into master 2024-06-02 02:33:31 +02:00

Alternative to #4341 (fixes #4339).

Background

Somehow, call to tt.reload_itemstack_description() invalidates iterators to minetest.registered_items, which are used internally by pairs() in the for loop in creative.lua which fills the creative inventory with items. While I haven't managed to pinpoint where exactly the aforementioned function invalidates the iterators, abstracting the calls into another loop running through the already picked inventory lists (which doesn't rely on iterators to minetest.registered_items) fixes the issue.

Testing

See the referenced issue and PR.

Alternative to #4341 (fixes #4339). ### Background Somehow, call to `tt.reload_itemstack_description()` invalidates iterators to `minetest.registered_items`, which are used internally by `pairs()` in the `for` loop in creative.lua which fills the creative inventory with items. While I haven't managed to pinpoint where exactly the aforementioned function invalidates the iterators, abstracting the calls into another loop running through the already picked inventory lists (which doesn't rely on iterators to `minetest.registered_items`) fixes the issue. ### Testing See the referenced issue and PR.
the-real-herowl added this to the 0.87.1 milestone 2024-06-02 00:52:45 +02:00
the-real-herowl added the
#P3: elevated
label 2024-06-02 00:52:46 +02:00
the-real-herowl added 1 commit 2024-06-02 00:52:47 +02:00
the-real-herowl added 1 commit 2024-06-02 01:45:02 +02:00
Member

Looks good to me.

Looks good to me.
the-real-herowl merged commit 21c182fc0e into master 2024-06-02 02:33:31 +02:00
the-real-herowl deleted branch it_inval_fix 2024-06-02 02:33:32 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#4354
No description provided.