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:
authorSebastian Parborg <darkdefende@gmail.com>2021-08-20 17:30:34 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-08-25 18:30:39 +0300
commitf49d438ced7c5874dbf43976d9901a462176f541 (patch)
treefae7b745eaf1e793b53119f3ec27c34621727c58 /source/blender/sequencer/intern/strip_relations.c
parent796035ad930383c26302ab6a57e8e6c90394603b (diff)
Cleanup and remove SEQ_ALL_BEGIN macro
We now use a for_each function with callback to iterate through all sequences in the scene. This has the benefit that we now only loop over the sequences in the scene once. Before we would loop over them twice and allocate memory to store temporary data. The allocation of temporary data lead to unintentional memory leaks if the code used returns to exit out of the iteration loop. The new for_each callback method doesn't allocate any temporary data and only iterates though all sequences once. Reviewed By: Richard Antalik, Bastien Montagne Differential Revision: http://developer.blender.org/D12278
Diffstat (limited to 'source/blender/sequencer/intern/strip_relations.c')
-rw-r--r--source/blender/sequencer/intern/strip_relations.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/source/blender/sequencer/intern/strip_relations.c b/source/blender/sequencer/intern/strip_relations.c
index ec70a683da5..b840b19f244 100644
--- a/source/blender/sequencer/intern/strip_relations.c
+++ b/source/blender/sequencer/intern/strip_relations.c
@@ -476,6 +476,24 @@ void SEQ_relations_session_uuid_generate(struct Sequence *sequence)
sequence->runtime.session_uuid = BLI_session_uuid_generate();
}
+static bool get_uuids_cb(Sequence *seq, void *user_data)
+{
+ struct GSet *used_uuids = (struct GSet *)user_data;
+ const SessionUUID *session_uuid = &seq->runtime.session_uuid;
+ if (!BLI_session_uuid_is_generated(session_uuid)) {
+ printf("Sequence %s does not have UUID generated.\n", seq->name);
+ return true;
+ }
+
+ if (BLI_gset_lookup(used_uuids, session_uuid) != NULL) {
+ printf("Sequence %s has duplicate UUID generated.\n", seq->name);
+ return true;
+ }
+
+ BLI_gset_insert(used_uuids, (void *)session_uuid);
+ return true;
+}
+
void SEQ_relations_check_uuids_unique_and_report(const Scene *scene)
{
if (scene->ed == NULL) {
@@ -485,22 +503,7 @@ void SEQ_relations_check_uuids_unique_and_report(const Scene *scene)
struct GSet *used_uuids = BLI_gset_new(
BLI_session_uuid_ghash_hash, BLI_session_uuid_ghash_compare, "sequencer used uuids");
- const Sequence *sequence;
- SEQ_ALL_BEGIN (scene->ed, sequence) {
- const SessionUUID *session_uuid = &sequence->runtime.session_uuid;
- if (!BLI_session_uuid_is_generated(session_uuid)) {
- printf("Sequence %s does not have UUID generated.\n", sequence->name);
- continue;
- }
-
- if (BLI_gset_lookup(used_uuids, session_uuid) != NULL) {
- printf("Sequence %s has duplicate UUID generated.\n", sequence->name);
- continue;
- }
-
- BLI_gset_insert(used_uuids, (void *)session_uuid);
- }
- SEQ_ALL_END;
+ SEQ_for_each_callback(&scene->ed->seqbase, get_uuids_cb, used_uuids);
BLI_gset_free(used_uuids, NULL);
}