mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Mutex-protect the time conversion in the URLSynchronization to prevent a rare crash when accessing SpiceManager multithreaded
This commit is contained in:
@@ -222,8 +222,11 @@ bool UrlSynchronization::isEachFileValid() {
|
||||
// Valid to: yyyy-mm-ddThr:mn:sc.xxx
|
||||
|
||||
if (ossyncVersion == "1.0") {
|
||||
// We need to mutex-protect the access to the time conversion for now
|
||||
std::lock_guard guard(_mutex);
|
||||
|
||||
ghoul::getline(file >> std::ws, line);
|
||||
std::string& fileIsValidToDate = line;
|
||||
const std::string& fileIsValidToDate = line;
|
||||
const double fileValidAsJ2000 = Time::convertTime(fileIsValidToDate);
|
||||
|
||||
const std::string todaysDate = Time::currentWallTime();
|
||||
|
||||
@@ -122,6 +122,8 @@ private:
|
||||
|
||||
/// Determines how long the file is valid before it should be downloaded again
|
||||
double _secondsUntilResync = MaxDateAsJ2000;
|
||||
|
||||
std::mutex _mutex;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user