]> git.sesse.net Git - casparcg/commitdiff
[scene_producer] Fixed serious bug where uninitialized values were used.
authorHelge Norberg <helge.norberg@svt.se>
Tue, 14 Feb 2017 16:51:51 +0000 (17:51 +0100)
committerHelge Norberg <helge.norberg@svt.se>
Tue, 14 Feb 2017 16:51:51 +0000 (17:51 +0100)
core/producer/binding.h

index 71e31f2035942e76c63336993561ab265b521b73..c05934211bde24df744006f67f5788ca03586164 100644 (file)
@@ -31,6 +31,7 @@
 #include <stdexcept>
 
 #include <boost/lexical_cast.hpp>
+#include <boost/utility/value_init.hpp>
 
 #include <common/tweener.h>
 #include <common/except.h>
@@ -99,7 +100,7 @@ private:
                mutable bool            evaluated_              = false;
 
                impl()
-                       : value_()
+                       : value_(boost::value_initialized<T>())
                {
                }
 
@@ -110,7 +111,8 @@ private:
 
                template<typename Expr>
                impl(const Expr& expression)
-                       : expression_(expression)
+                       : value_(boost::value_initialized<T>())
+                       , expression_(expression)
                {
                }
 
@@ -142,7 +144,7 @@ private:
 
                void evaluate() const override
                {
-                       if (expression_)
+                       if (bound())
                        {
                                auto new_value = expression_();
 
@@ -182,7 +184,7 @@ private:
 
                void unbind()
                {
-                       if (expression_)
+                       if (bound())
                        {
                                expression_ = std::function<T ()>();
                                dependencies_.clear();