We must not have the font manager locked when locking the desktop (no matter

if read or write); there are some methods that cause a locking of the font
manager (like ServerFont::SetFamilyAndStyle()).
This fixes bug #885.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19051 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-10-12 12:34:19 +00:00
parent 08d8ae0cff
commit 6edab6011e
2 changed files with 11 additions and 3 deletions

View File

@ -1042,7 +1042,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
// 2) string - family
// 3) string - style
// 4) float - size
char type[B_OS_NAME_LENGTH];
font_family familyName;
font_style styleName;
@ -1052,11 +1052,16 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
&& link.ReadString(familyName, sizeof(familyName)) == B_OK
&& link.ReadString(styleName, sizeof(styleName)) == B_OK
&& link.Read<float>(&size) == B_OK) {
BAutolock locker(gFontManager);
gFontManager->Lock();
FontStyle* style = gFontManager->GetStyle(familyName, styleName);
if (style != NULL) {
ServerFont font(*style, size);
gFontManager->Unlock();
// We must not have locked the font manager when
// locking the desktop (through LockedDesktopSettings
// below)
LockedDesktopSettings settings(fDesktop);
if (!strcmp(type, "plain"))
@ -1065,7 +1070,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
settings.SetDefaultBoldFont(font);
else if (!strcmp(type, "fixed"))
settings.SetDefaultFixedFont(font);
}
} else
gFontManager->Unlock();
}
break;
}

View File

@ -240,6 +240,8 @@ ServerFont::SetStyle(FontStyle* style)
/*!
\brief Sets the ServerFont instance to whatever font is specified
This method will lock the font manager.
\param familyID ID number of the family to set
\param styleID ID number of the style to set
\return B_OK if successful, B_ERROR if not