File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 42
42
#include " precomp.hpp"
43
43
#include < opencv2/dnn/layer.details.hpp>
44
44
45
+ #include < google/protobuf/stubs/common.h>
46
+
45
47
namespace cv {
46
48
namespace dnn {
47
49
CV__DNN_EXPERIMENTAL_NS_BEGIN
@@ -56,11 +58,26 @@ Mutex& getInitializationMutex()
56
58
// force initialization (single-threaded environment)
57
59
Mutex* __initialization_mutex_initializer = &getInitializationMutex ();
58
60
61
+ namespace {
62
+ using namespace google ::protobuf;
63
+ class ProtobufShutdown {
64
+ public:
65
+ bool initialized;
66
+ ProtobufShutdown () : initialized(true ) {}
67
+ ~ProtobufShutdown ()
68
+ {
69
+ initialized = false ;
70
+ google::protobuf::ShutdownProtobufLibrary ();
71
+ }
72
+ };
73
+ } // namespace
59
74
60
75
void initializeLayerFactory ()
61
76
{
62
77
CV_TRACE_FUNCTION ();
63
78
79
+ static ProtobufShutdown protobufShutdown; (void )protobufShutdown;
80
+
64
81
CV_DNN_REGISTER_LAYER_CLASS (Slice, SliceLayer);
65
82
CV_DNN_REGISTER_LAYER_CLASS (Split, SplitLayer);
66
83
CV_DNN_REGISTER_LAYER_CLASS (Concat, ConcatLayer);
You can’t perform that action at this time.
0 commit comments