Commit 7bd3ccd9 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #8713 from grundman:patch-6

parents 37b1bc9d cf4e9e5c
...@@ -222,7 +222,7 @@ public: ...@@ -222,7 +222,7 @@ public:
}; };
namespace namespace
{ {
MatAllocator* g_matAllocator = NULL; MatAllocator* volatile g_matAllocator = NULL;
} }
...@@ -230,7 +230,11 @@ MatAllocator* Mat::getDefaultAllocator() ...@@ -230,7 +230,11 @@ MatAllocator* Mat::getDefaultAllocator()
{ {
if (g_matAllocator == NULL) if (g_matAllocator == NULL)
{ {
g_matAllocator = getStdAllocator(); cv::AutoLock lock(cv::getInitializationMutex());
if (g_matAllocator == NULL)
{
g_matAllocator = getStdAllocator();
}
} }
return g_matAllocator; return g_matAllocator;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment