summaryrefslogtreecommitdiff
path: root/src/dot.cpp
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2022-12-27 12:33:07 +0900
committerJinWang An <jinwang.an@samsung.com>2022-12-27 12:33:07 +0900
commit9cf4982ab5fc6d964e1a024ff91a72d1fee5dc00 (patch)
treea19f0c024ea91acd7177f41fb5f066023f49027b /src/dot.cpp
parent15e5c5601a13a41757e2a5e1a9105d1714d40215 (diff)
downloaddoxygen-9cf4982ab5fc6d964e1a024ff91a72d1fee5dc00.tar.gz
doxygen-9cf4982ab5fc6d964e1a024ff91a72d1fee5dc00.tar.bz2
doxygen-9cf4982ab5fc6d964e1a024ff91a72d1fee5dc00.zip
Imported Upstream version 1.9.4upstream/1.9.4
Diffstat (limited to 'src/dot.cpp')
-rw-r--r--src/dot.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/dot.cpp b/src/dot.cpp
index e42b73d..1d44dd9 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -17,6 +17,7 @@
#include <cassert>
#include <sstream>
#include <algorithm>
+#include <mutex>
#include "config.h"
#include "dot.h"
@@ -36,6 +37,8 @@
static QCString g_dotFontPath;
+static std::mutex g_dotManagerMutex;
+
static void setDotFontPath(const QCString &path)
{
ASSERT(g_dotFontPath.isEmpty());
@@ -72,21 +75,10 @@ static void unsetDotFontPath()
//--------------------------------------------------------------------
-DotManager *DotManager::m_theInstance = 0;
-
DotManager *DotManager::instance()
{
- if (!m_theInstance)
- {
- m_theInstance = new DotManager;
- }
- return m_theInstance;
-}
-
-void DotManager::deleteInstance()
-{
- delete m_theInstance;
- m_theInstance=0;
+ static DotManager theInstance;
+ return &theInstance;
}
DotManager::DotManager() : m_runners(), m_filePatchers()
@@ -98,7 +90,7 @@ DotManager::DotManager() : m_runners(), m_filePatchers()
{
for (i=0;i<dotNumThreads;i++)
{
- std::unique_ptr<DotWorkerThread> thread = std::make_unique<DotWorkerThread>(m_queue);
+ DotWorkerThreadPtr thread(new DotWorkerThread(m_queue));
thread->start();
if (thread->isRunning())
{
@@ -114,11 +106,12 @@ DotManager::DotManager() : m_runners(), m_filePatchers()
DotManager::~DotManager()
{
- delete m_queue;
+ if (!Doxygen::terminating) delete m_queue;
}
DotRunner* DotManager::createRunner(const QCString &absDotName, const QCString& md5Hash)
{
+ std::lock_guard<std::mutex> lock(g_dotManagerMutex);
DotRunner* rv = nullptr;
auto const runit = m_runners.find(absDotName.str());
if (runit == m_runners.end())
@@ -142,6 +135,7 @@ DotRunner* DotManager::createRunner(const QCString &absDotName, const QCString&
DotFilePatcher *DotManager::createFilePatcher(const QCString &fileName)
{
+ std::lock_guard<std::mutex> lock(g_dotManagerMutex);
auto patcher = m_filePatchers.find(fileName.str());
if (patcher != m_filePatchers.end()) return &(patcher->second);
@@ -280,7 +274,7 @@ void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir,
}
QCString imgExt = getDotImageExtension();
- QCString imgName = (QCString)outFile+"."+imgExt;
+ QCString imgName = QCString(outFile)+"."+imgExt;
QCString absImgName = QCString(d.absPath())+"/"+imgName;
QCString absOutFile = QCString(d.absPath())+"/"+outFile;