diff options
author | louis <louis.braun@gmx.de> | 2015-04-06 09:58:33 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-04-06 09:58:33 +0200 |
commit | d70bfe70913602de016e14d17d4ac485a8683cf5 (patch) | |
tree | ee00aff7748877323d71ac75d97924ced3029395 /libtemplate/templatefunction.c | |
parent | f316b2628aa63a7d37c9a76ad147fc6e04e14fa3 (diff) | |
download | vdr-plugin-skindesigner-d70bfe70913602de016e14d17d4ac485a8683cf5.tar.gz vdr-plugin-skindesigner-d70bfe70913602de016e14d17d4ac485a8683cf5.tar.bz2 |
added locks around cTextWrappers to avoid crashed when concurrently accessing fonts
Diffstat (limited to 'libtemplate/templatefunction.c')
-rw-r--r-- | libtemplate/templatefunction.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 6aa1ddd..2e6a743 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -1331,8 +1331,10 @@ int cTemplateFunction::CalculateTextBoxHeight(void) { int floatType = GetNumericParameter(ptFloat);
if (floatType == flNone) {
+ fontManager->Lock();
cTextWrapper wrapper;
wrapper.Set(text.c_str(), font, width);
+ fontManager->Unlock();
int lines = wrapper.Lines();
return (lines * fontHeight);
}
@@ -1370,7 +1372,9 @@ int cTemplateFunction::CalculateTextBoxHeight(void) { } else {
cTextWrapper wrapper;
if (drawNarrow) {
+ fontManager->Lock();
wrapper.Set((flds[i].c_str()), font, widthNarrow);
+ fontManager->Unlock();
int newLines = wrapper.Lines();
//check if wrapper fits completely into narrow area
if (linesDrawn + newLines < linesNarrow) {
@@ -1392,7 +1396,9 @@ int cTemplateFunction::CalculateTextBoxHeight(void) { drawNarrow = false;
}
} else {
+ fontManager->Lock();
wrapper.Set((flds[i].c_str()), font, width);
+ fontManager->Unlock();
for (int line = 0; line < wrapper.Lines(); line++) {
sstrTextFull << wrapper.GetLine(line) << " ";
}
@@ -1400,8 +1406,12 @@ int cTemplateFunction::CalculateTextBoxHeight(void) { }
}
}
+ fontManager->Lock();
wTextTall.Set(sstrTextTall.str().c_str(), font, widthNarrow);
+ fontManager->Unlock();
+ fontManager->Lock();
wTextFull.Set(sstrTextFull.str().c_str(), font, width);
+ fontManager->Unlock();
int textLinesTall = wTextTall.Lines();
int textLinesFull = wTextFull.Lines();
|