]> git.sesse.net Git - casparcg/blobdiff - common/executor.h
Fixed null pointer reference in executor
[casparcg] / common / executor.h
index f161ccd61912488491da500f17692bc0b71e180c..e67a0afa708e8adb04a458ea2382efe52a158c3a 100644 (file)
@@ -81,7 +81,7 @@ public:
        
        ~executor()
        {
-               CASPAR_LOG(trace) << L"Shutting down " << name_;
+               CASPAR_LOG(debug) << L"Shutting down " << name_;
 
                try
                {
@@ -239,7 +239,7 @@ private:
 
                if (!execution_queue_.try_push(priority, function))
                {
-                       CASPAR_LOG(debug) << print() << L" Overflow. Blocking caller.";
+                       CASPAR_LOG(warning) << print() << L" Overflow. Blocking caller.";
                        execution_queue_.push(priority, function);
                }
 
@@ -250,7 +250,24 @@ private:
                                function();
                        }
 
-                       return future.get();
+                       try
+                       {
+                               return future.get();
+                       }
+                       catch (const caspar_exception& e)
+                       {
+                               if (!is_current()) // Add context information from this thread before rethrowing.
+                               {
+                                       auto ctx_info = boost::get_error_info<context_info_t>(e);
+
+                                       if (ctx_info)
+                                               e << context_info(get_context() + *ctx_info);
+                                       else
+                                               e << context_info(get_context());
+                               }
+
+                               throw;
+                       }
                });
        }