app_server: lock font manager in PicturePlayers accesses
Change-Id: I0a5e59d7141167d8fb22d9cf23baeddd2ea8a8df Reviewed-on: https://review.haiku-os.org/c/haiku/+/7922 Haiku-Format: Haiku-format Bot <[email protected]> Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
78d164f7ee
commit
13e1bd391b
@@ -616,9 +616,11 @@ set_font_family(void* _state, const char* _family, size_t length)
|
||||
reinterpret_cast<BoundingBoxState*>(_state);
|
||||
|
||||
BString family(_family, length);
|
||||
gFontManager->Lock();
|
||||
FontStyle* fontStyle = gFontManager->GetStyleByIndex(family, 0);
|
||||
ServerFont font;
|
||||
font.SetStyle(fontStyle);
|
||||
gFontManager->Unlock();
|
||||
state->GetDrawState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
|
||||
}
|
||||
|
||||
@@ -631,8 +633,10 @@ set_font_style(void* _state, const char* _style, size_t length)
|
||||
|
||||
BString style(_style, length);
|
||||
ServerFont font(state->GetDrawState()->Font());
|
||||
gFontManager->Lock();
|
||||
FontStyle* fontStyle = gFontManager->GetStyle(font.Family(), style);
|
||||
font.SetStyle(fontStyle);
|
||||
gFontManager->Unlock();
|
||||
state->GetDrawState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -790,9 +790,11 @@ set_font_family(void* _canvas, const char* _family, size_t length)
|
||||
Canvas* const canvas = reinterpret_cast<Canvas*>(_canvas);
|
||||
BString family(_family, length);
|
||||
|
||||
gFontManager->Lock();
|
||||
FontStyle* fontStyle = gFontManager->GetStyleByIndex(family, 0);
|
||||
ServerFont font;
|
||||
font.SetStyle(fontStyle);
|
||||
gFontManager->Unlock();
|
||||
canvas->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
|
||||
}
|
||||
|
||||
@@ -805,9 +807,11 @@ set_font_style(void* _canvas, const char* _style, size_t length)
|
||||
|
||||
ServerFont font(canvas->CurrentState()->Font());
|
||||
|
||||
gFontManager->Lock();
|
||||
FontStyle* fontStyle = gFontManager->GetStyle(font.Family(), style);
|
||||
|
||||
font.SetStyle(fontStyle);
|
||||
gFontManager->Unlock();
|
||||
canvas->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ FontStyle*
|
||||
GlobalFontManager::GetStyle(const char* familyName, const char* styleName,
|
||||
uint16 familyID, uint16 styleID, uint16 face)
|
||||
{
|
||||
BAutolock locker(this);
|
||||
ASSERT(IsLocked());
|
||||
|
||||
if (styleID != 0xffff && (familyName == NULL || !familyName[0])
|
||||
&& (styleName == NULL || !styleName[0])) {
|
||||
|
||||
Reference in New Issue
Block a user