View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017319 | Scribus | Import / Export | public | 2024-11-22 14:16 | 2024-11-22 14:16 |
Reporter | tropion | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | sometimes |
Status | new | Resolution | open | ||
Product Version | 1.7.0.svn | ||||
Summary | 0017319: Scribuses working in parallel overwrite each others temp files | ||||
Description | I tried to use several scribuses in parallel to convert .sla files to .pdf files. Sometimes the resulting .pdfs contain corrupt images. This happens, because the different scribuses all use the same temp file names and sometimes they overwrite each others temp files. I suggest adding something like QString::number(QCoreApplication::applicationPid()) as a subdir to the path in ScPaths::tempFileDir(). And though I am really not sure if this is the right place to clean that up I suggest adding QDir tmpDir (ScPaths::tempFileDir()); tmpDir.rmdir (ScPaths::tempFileDir()); to ScribusQApp::~ScribusQApp() | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
tempDir.diff (1,334 bytes)
diff --git a/scribus/scpaths.cpp b/scribus/scpaths.cpp index 74b8fdf14..d17fb3e0f 100644 --- a/scribus/scpaths.cpp +++ b/scribus/scpaths.cpp @@ -656,11 +656,16 @@ QString ScPaths::tempFileDir() // GetTempPath may return Windows directory, better not use this one // for temporary files if (QDir(tempPath).exists() && tempPath != windowsSpecialDir(CSIDL_WINDOWS)) - return tempPath; + { + QDir tempAppDirectory(tempPath + QString::number(QCoreApplication::applicationPid())); + if (!tempAppDirectory.exists()) + tempAppDirectory.mkpath(tempAppDirectory.absolutePath()); + return tempAppDirectory.absolutePath() + "/"; + } } #endif - QDir tempAppDirectory(applicationDataDir() + "temp/"); + QDir tempAppDirectory(applicationDataDir() + "temp/" + QString::number(QCoreApplication::applicationPid())); if (!tempAppDirectory.exists()) tempAppDirectory.mkpath(tempAppDirectory.absolutePath()); return tempAppDirectory.absolutePath() + "/"; diff --git a/scribus/scribusapp.cpp b/scribus/scribusapp.cpp index 159ac2f0e..330e1c993 100644 --- a/scribus/scribusapp.cpp +++ b/scribus/scribusapp.cpp @@ -110,6 +110,8 @@ ScribusQApp::~ScribusQApp() { delete m_ScCore; delete m_scDLMgr; + QDir tmpDir (ScPaths::tempFileDir()); + tmpDir.rmdir (ScPaths::tempFileDir()); LanguageManager::deleteInstance(); } |