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) {
|
if (status != B_OK) {
|
||||||
fLink.StartMessage(status);
|
fLink.StartMessage(status);
|
||||||
} else {
|
} else {
|
||||||
ServerFont* font = new(std::nothrow) ServerFont();
|
ServerFont font;
|
||||||
if (font == NULL) {
|
status = font.SetFamilyAndStyle(familyID, styleID,
|
||||||
fLink.StartMessage(B_NO_MEMORY);
|
|
||||||
fLink.Flush();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = font->SetFamilyAndStyle(familyID, styleID,
|
|
||||||
fAppFontManager);
|
fAppFontManager);
|
||||||
|
|
||||||
|
fLink.StartMessage(status);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
fLink.StartMessage(B_OK);
|
fLink.Attach<uint16>(font.FamilyID());
|
||||||
fLink.Attach<uint16>(font->FamilyID());
|
fLink.Attach<uint16>(font.StyleID());
|
||||||
fLink.Attach<uint16>(font->StyleID());
|
fLink.Attach<uint16>(font.Face());
|
||||||
fLink.Attach<uint16>(font->Face());
|
|
||||||
} else {
|
|
||||||
fLink.StartMessage(status);
|
|
||||||
delete font;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1720,27 +1711,19 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
fLink.StartMessage(status);
|
fLink.StartMessage(status);
|
||||||
free(fontData);
|
free(fontData);
|
||||||
} else {
|
} else {
|
||||||
ServerFont* font = new(std::nothrow) ServerFont();
|
ServerFont font;
|
||||||
if (font == NULL) {
|
status = font.SetFamilyAndStyle(familyID, styleID,
|
||||||
free(fontData);
|
|
||||||
fLink.StartMessage(B_NO_MEMORY);
|
|
||||||
fLink.Flush();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = font->SetFamilyAndStyle(familyID, styleID,
|
|
||||||
fAppFontManager);
|
fAppFontManager);
|
||||||
|
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
font->SetFontData(fontData, size);
|
font.SetFontData(fontData, size);
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
fLink.Attach<uint16>(font->FamilyID());
|
fLink.Attach<uint16>(font.FamilyID());
|
||||||
fLink.Attach<uint16>(font->StyleID());
|
fLink.Attach<uint16>(font.StyleID());
|
||||||
fLink.Attach<uint16>(font->Face());
|
fLink.Attach<uint16>(font.Face());
|
||||||
} else {
|
} else {
|
||||||
fLink.StartMessage(status);
|
fLink.StartMessage(status);
|
||||||
free(fontData);
|
free(fontData);
|
||||||
delete font;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user