*RichText: Resolved deadlock situation

git-svn-id: svn://ultimatepp.org/upp/trunk@5255 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-08-04 12:52:42 +00:00
parent f5932f9add
commit 9bdfc68c2d
3 changed files with 6 additions and 10 deletions

View file

@ -128,8 +128,8 @@ INITBLOCK { AddIniInfo(#var, AsStringIniCurrent_##var, AsStringIniDefault_##var,
#define INI_INT64(var, def, info) INI_TYPE(var, def, info, int64, IniInt64, 0);
#define INI_DOUBLE(var, def, info) INI_TYPE(var, def, info, double, IniDouble, 0);
#define INI_STRING(var, def, info) String& DefRef##_var() { static String x; return x; }\
INI_TYPE(var, def, info, String, IniString, DefRef##_var);
#define INI_STRING(var, def, info) String& DefRef_##var() { static String x; return x; }\
INI_TYPE(var, def, info, String, IniString, DefRef_##var);
/*
#define INI_BOOL(var, def, info)\

View file

@ -2,8 +2,6 @@
NAMESPACE_UPP
static StaticMutex sCacheMutex;
Array<RichPara>& RichPara::Cache()
{
static Array<RichPara> x;
@ -26,7 +24,7 @@ RichPara::RichPara()
RichPara::~RichPara()
{
if(cacheid && !part.IsPicked() && !incache) {
Mutex::Lock __(sCacheMutex);
DrawLock __;
Array<RichPara>& cache = Cache();
incache = true;
cache.InsertPick(0, *this);
@ -568,7 +566,7 @@ void RichPara::Unpack(const String& data, const Array<RichObject>& obj,
format = style;
if(cacheid) {
Mutex::Lock __(sCacheMutex);
DrawLock __;
Array<RichPara>& cache = Cache();
for(int i = 0; i < cache.GetCount(); i++)
if(cache[i].cacheid == cacheid) {

View file

@ -212,12 +212,10 @@ Array<RichPara::Lines>& RichPara::Lines::Cache()
return x;
}
static StaticMutex sLineCacheMutex;
RichPara::Lines::~Lines()
{
if(cacheid && !line.IsPicked() && !incache) {
Mutex::Lock __(sLineCacheMutex);
DrawLock __;
Array<Lines>& cache = Cache();
incache = true;
cache.Insert(0) = *this;
@ -238,7 +236,7 @@ RichPara::Lines RichPara::FormatLines(int acx) const
{
Lines lines;
if(cacheid) {
Mutex::Lock __(sLineCacheMutex);
DrawLock __;
Array<Lines>& cache = Lines::Cache();
for(int i = 0; i < cache.GetCount(); i++)
if(cache[i].cacheid == cacheid && cache[i].cx == acx) {