]> git.sesse.net Git - movit/commitdiff
Add an assertion failure that we don't add the same effect instance twice.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 1 Jan 2014 23:25:24 +0000 (00:25 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 1 Jan 2014 23:25:24 +0000 (00:25 +0100)
Doing this causes hard-to-understand crashes, so just bomb out at once.

effect_chain.cpp

index f88a4f74986fce003ca4cf0b745c3becdbc018c0..6b7a857242e0572c7be6d66afe6026734ec99c6c 100644 (file)
@@ -66,6 +66,10 @@ void EffectChain::add_output(const ImageFormat &format, OutputAlphaFormat alpha_
 
 Node *EffectChain::add_node(Effect *effect)
 {
 
 Node *EffectChain::add_node(Effect *effect)
 {
+       for (unsigned i = 0; i < nodes.size(); ++i) {
+               assert(nodes[i]->effect != effect);
+       }
+
        char effect_id[256];
        sprintf(effect_id, "eff%u", (unsigned)nodes.size());
 
        char effect_id[256];
        sprintf(effect_id, "eff%u", (unsigned)nodes.size());