]> git.tdb.fi Git - libs/gl.git/commitdiff
Rearrange postprocessor creation code in SequenceBuilder
authorMikko Rasa <tdb@tdb.fi>
Tue, 19 Oct 2021 12:38:09 +0000 (15:38 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 19 Oct 2021 12:38:09 +0000 (15:38 +0300)
Previously it would have inadvertently deleted overridden postprocessors.

source/builders/sequencebuilder.cpp

index eff9348b8395a78226436110633a400c9e373d26..f007350eeaa0e76ad023055f59d133bd407e368a 100644 (file)
@@ -74,27 +74,26 @@ void SequenceBuilder::build(Sequence &sequence) const
 #endif
        for(const SequenceTemplate::PostProcessor &p: tmpl.get_postprocessors())
        {
-               RefPtr<PostProcessor> proc = 0;
+               PostProcessor *proc = 0;
                if(!p.slot_name.empty())
                        proc = get_item(postprocessors, p.slot_name);
-               if(proc)
-                       sequence.add_postprocessor(*proc);
-               else if(p.postprocessor_template)
+               if(!proc)
                {
-                       proc = p.postprocessor_template->create(sequence.get_width(), sequence.get_height());
-                       if(proc)
+                       if(p.postprocessor_template)
                        {
+                               proc = p.postprocessor_template->create(sequence.get_width(), sequence.get_height());
 #ifdef DEBUG
                                if(!debug_name.empty())
                                        proc->set_debug_name(format("%s/%d.pproc", debug_name, index++));
 #endif
-                               sequence.add_postprocessor(*proc.get());
-                               sequence.add_owned(proc.release());
                        }
+                       else
+                               throw invalid_operation("SequenceBuilder::build");
+
+                       sequence.add_owned(proc);
                }
 
-               if(!proc)
-                       throw invalid_operation("SequenceBuilder::build");
+               sequence.add_postprocessor(*proc);
        }
 }