From: Mikko Rasa Date: Tue, 19 Oct 2021 12:38:09 +0000 (+0300) Subject: Rearrange postprocessor creation code in SequenceBuilder X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=54fdd850d1e657bc357d859a532497905ded741a;p=libs%2Fgl.git Rearrange postprocessor creation code in SequenceBuilder Previously it would have inadvertently deleted overridden postprocessors. --- diff --git a/source/builders/sequencebuilder.cpp b/source/builders/sequencebuilder.cpp index eff9348b..f007350e 100644 --- a/source/builders/sequencebuilder.cpp +++ b/source/builders/sequencebuilder.cpp @@ -74,27 +74,26 @@ void SequenceBuilder::build(Sequence &sequence) const #endif for(const SequenceTemplate::PostProcessor &p: tmpl.get_postprocessors()) { - RefPtr 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); } }