app_server: fix dangling references in user fonts
Change-Id: I213959b407245c6c0eb1208ebea7145f699366fa Reviewed-on: https://review.haiku-os.org/c/haiku/+/6061 Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
85d52d335d
commit
88b5bdf748
@@ -1607,24 +1607,15 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
if (status != B_OK) {
|
||||
fLink.StartMessage(status);
|
||||
} else {
|
||||
ServerFont* font = new(std::nothrow) ServerFont();
|
||||
if (font == NULL) {
|
||||
fLink.StartMessage(B_NO_MEMORY);
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
|
||||
status = font->SetFamilyAndStyle(familyID, styleID,
|
||||
ServerFont font;
|
||||
status = font.SetFamilyAndStyle(familyID, styleID,
|
||||
fAppFontManager);
|
||||
|
||||
fLink.StartMessage(status);
|
||||
if (status == B_OK) {
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<uint16>(font->FamilyID());
|
||||
fLink.Attach<uint16>(font->StyleID());
|
||||
fLink.Attach<uint16>(font->Face());
|
||||
} else {
|
||||
fLink.StartMessage(status);
|
||||
delete font;
|
||||
fLink.Attach<uint16>(font.FamilyID());
|
||||
fLink.Attach<uint16>(font.StyleID());
|
||||
fLink.Attach<uint16>(font.Face());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1720,27 +1711,19 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
fLink.StartMessage(status);
|
||||
free(fontData);
|
||||
} else {
|
||||
ServerFont* font = new(std::nothrow) ServerFont();
|
||||
if (font == NULL) {
|
||||
free(fontData);
|
||||
fLink.StartMessage(B_NO_MEMORY);
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
|
||||
status = font->SetFamilyAndStyle(familyID, styleID,
|
||||
ServerFont font;
|
||||
status = font.SetFamilyAndStyle(familyID, styleID,
|
||||
fAppFontManager);
|
||||
|
||||
if (status == B_OK) {
|
||||
font->SetFontData(fontData, size);
|
||||
font.SetFontData(fontData, size);
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<uint16>(font->FamilyID());
|
||||
fLink.Attach<uint16>(font->StyleID());
|
||||
fLink.Attach<uint16>(font->Face());
|
||||
fLink.Attach<uint16>(font.FamilyID());
|
||||
fLink.Attach<uint16>(font.StyleID());
|
||||
fLink.Attach<uint16>(font.Face());
|
||||
} else {
|
||||
fLink.StartMessage(status);
|
||||
free(fontData);
|
||||
delete font;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user