Don't access Config from the static creation of dcpomatic_log.
authorCarl Hetherington <cth@carlh.net>
Mon, 26 Nov 2018 01:22:06 +0000 (01:22 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 26 Nov 2018 01:22:06 +0000 (01:22 +0000)
src/lib/file_log.cc
src/lib/file_log.h
src/lib/log.cc
src/lib/log.h

index c2a33d4252b3a7a582fa2ae1c45a48508e1c270d..be532c10fb648adab268b13c6d3c2401b5d72aae 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "file_log.h"
 #include "cross.h"
+#include "config.h"
 #include <cstdio>
 #include <iostream>
 
@@ -32,7 +33,14 @@ using boost::shared_ptr;
 FileLog::FileLog (boost::filesystem::path file)
        : _file (file)
 {
+       _config_connection = Config::instance()->Changed.connect (boost::bind (&FileLog::config_changed, this));
+       config_changed ();
+}
 
+void
+FileLog::config_changed ()
+{
+       set_types (Config::instance()->log_types ());
 }
 
 void
index 6904bfd77436def72047217d00dbd9823771ddf2..83f3696095cd7d48cf8529c3bbf9c52f2b59e6cf 100644 (file)
@@ -29,6 +29,9 @@ public:
 
 private:
        void do_log (boost::shared_ptr<const LogEntry> entry);
+       void config_changed ();
+
        /** filename to write to */
        boost::filesystem::path _file;
+       boost::signals2::scoped_connection _config_connection;
 };
index e3ffd1cadcc05f4f114e107df4e870d46ce0a3f6..7851c133f9bc74f84a8cc912eecca63acd484b03 100644 (file)
@@ -38,14 +38,7 @@ using boost::shared_ptr;
 Log::Log ()
        : _types (0)
 {
-       _config_connection = Config::instance()->Changed.connect (boost::bind (&Log::config_changed, this));
-       config_changed ();
-}
 
-void
-Log::config_changed ()
-{
-       set_types (Config::instance()->log_types ());
 }
 
 void
index 65d0229e981876a2e1741f580ce51460d4aa214d..b102a2d653983c3368bf04d8669f5f440e05df19 100644 (file)
@@ -59,11 +59,9 @@ protected:
 
 private:
        virtual void do_log (boost::shared_ptr<const LogEntry> entry) = 0;
-       void config_changed ();
 
        /** bit-field of log types which should be put into the log (others are ignored) */
        int _types;
-       boost::signals2::scoped_connection _config_connection;
 };
 
 #endif