app_server FontManager: remove not owned family deletion
On adding a font, we may or not have other faces of the same family, so we may be trying to add the new face to an already managed family. In that case, we can't delete it when we get an error inserting the new style. This same code was already in place before the user fonts, but it's much more unlikely to trigger, except maybe on purpose. A later patch refactoring a bunch of things will join both into the base class. Fixes #18169 Change-Id: I78053b6e941c18b952fc2bd64f393e26d3d53b0a
This commit is contained in:
@@ -52,6 +52,7 @@ AppFontManager::_AddUserFont(FT_Face face, node_ref nodeRef, const char* path,
|
||||
uint16& familyID, uint16& styleID)
|
||||
{
|
||||
FontFamily* family = _FindFamily(face->family_name);
|
||||
bool isNewFontFamily = family == NULL;
|
||||
if (family != NULL
|
||||
&& family->HasStyle(face->style_name)) {
|
||||
// prevent adding the same style twice
|
||||
@@ -78,7 +79,8 @@ AppFontManager::_AddUserFont(FT_Face face, node_ref nodeRef, const char* path,
|
||||
|
||||
if (style == NULL || !family->AddStyle(style)) {
|
||||
delete style;
|
||||
delete family;
|
||||
if (isNewFontFamily)
|
||||
delete family;
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user