\r
class destroy_producer_proxy : public frame_producer\r
{ \r
- std::shared_ptr<frame_producer>* producer_;\r
+ std::unique_ptr<std::shared_ptr<frame_producer>> producer_;\r
public:\r
destroy_producer_proxy(safe_ptr<frame_producer>&& producer) \r
: producer_(new std::shared_ptr<frame_producer>(std::move(producer)))\r
CASPAR_LOG(trace) << "Created destroyer: " << destroyer_count;\r
}\r
\r
- auto producer = producer_;\r
+ auto producer = producer_.release();\r
auto pool = destroyers;\r
destroyer->begin_invoke([=]\r
{\r
+ std::unique_ptr<std::shared_ptr<frame_producer>> producer2(producer);\r
+\r
+ auto str = (*producer2)->print();\r
try\r
{\r
if(!producer->unique())\r
- CASPAR_LOG(trace) << (*producer)->print() << L" Not destroyed on safe asynchronous destruction thread: " << producer->use_count();\r
+ CASPAR_LOG(trace) << str << L" Not destroyed on safe asynchronous destruction thread: " << producer->use_count();\r
else\r
- CASPAR_LOG(trace) << (*producer)->print() << L" Destroying on safe asynchronous destruction thread.";\r
+ CASPAR_LOG(trace) << str << L" Destroying on safe asynchronous destruction thread.";\r
}\r
catch(...){}\r
-\r
- delete producer;\r
+ \r
+ producer2.reset();\r
+ CASPAR_LOG(debug) << str << L" Destroyed.";\r
pool->push(destroyer);\r
}); \r
}\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
try\r
{\r
- delete producer_;\r
+ auto str = (*producer_)->print();\r
+ producer_.reset();\r
+ CASPAR_LOG(debug) << str << L" Destroyed.";\r
}\r
catch(...){}\r
}\r