1
0
mirror of https://github.com/aseprite/aseprite.git synced 2025-03-25 23:37:05 +00:00

Fix some extra issues reported by the ThreadSanitizer

This commit is contained in:
David Capello 2020-06-17 18:10:26 -03:00
parent 6f048d10c5
commit 319733d30b
6 changed files with 12 additions and 7 deletions

2
laf

@ -1 +1 @@
Subproject commit 0dd4ba1bdd910fb00d2e209d8c3b4454a09ce271
Subproject commit 85a17a563197ab8ec14ad43a727ab10173439f83

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2019-2020 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -10,6 +10,7 @@
#include "base/time.h"
#include <atomic>
#include <condition_variable>
#include <mutex>
#include <thread>
@ -49,7 +50,7 @@ namespace app {
base::tick_t timestamp;
};
bool m_done;
std::atomic<bool> m_done;
base::tick_t m_dataRecoveryPeriodMSecs;
base::tick_t m_keepClosedDocAliveForMSecs;
std::vector<ClosedDoc> m_docs;

@ -110,6 +110,8 @@ void BackupObserver::onRemoveDocument(Doc* doc)
// then it's deleted from ClosedDocs::backgroundThread()
TRACE("RECO: Adding to CLOSEDOC %p\n", doc);
std::unique_lock<std::mutex> lock(m_mutex);
m_closedDocs.push_back(doc);
}
else {

@ -125,7 +125,7 @@ void Doc::unlock()
m_rwLock.unlock();
}
bool Doc::weakLock(base::RWLock::WeakLock* weak_lock_flag)
bool Doc::weakLock(std::atomic<base::RWLock::WeakLock>* weak_lock_flag)
{
return m_rwLock.weakLock(weak_lock_flag);
}

@ -26,6 +26,7 @@
#include "obs/observable.h"
#include "os/color_space.h"
#include <atomic>
#include <memory>
#include <string>
@ -79,7 +80,7 @@ namespace app {
void downgradeToRead();
void unlock();
bool weakLock(base::RWLock::WeakLock* weak_lock_flag);
bool weakLock(std::atomic<base::RWLock::WeakLock>* weak_lock_flag);
void weakUnlock();
// Sets active/running transaction.

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -13,6 +13,7 @@
#include "app/doc.h"
#include "base/exception.h"
#include <atomic>
#include <exception>
namespace app {
@ -245,7 +246,7 @@ namespace app {
WeakDocReader(const WeakDocReader&);
WeakDocReader& operator=(const WeakDocReader&);
base::RWLock::WeakLock m_weak_lock;
std::atomic<base::RWLock::WeakLock> m_weak_lock;
};
} // namespace app