vt: parse_font_info_static should set refcount, not parse_font_info
As we get started with no memory allocator, we set up static font data for font passed by loader (if there is any). At this time, we also must set refcount 1, and refcount will get incremented in cnprobe() callback. At some point the memory allocator will be available, and we will set up properly allocated font data, but we should not disturb the refcount. PR: 253147
This commit is contained in:
parent
8fb966790e
commit
1912d2b15e
@ -1487,6 +1487,8 @@ parse_font_info_static(struct font_info *fi)
|
||||
vfp = &vt_font_loader;
|
||||
vfp->vf_height = fi->fi_height;
|
||||
vfp->vf_width = fi->fi_width;
|
||||
/* This is default font, set refcount 1 to disable removal. */
|
||||
vfp->vf_refcount = 1;
|
||||
for (unsigned i = 0; i < VFNT_MAPS; i++) {
|
||||
if (fi->fi_map_count[i] == 0)
|
||||
continue;
|
||||
@ -1499,6 +1501,12 @@ parse_font_info_static(struct font_info *fi)
|
||||
return (vfp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up default font with allocated data structures.
|
||||
* However, we can not set refcount here, because it is already set and
|
||||
* incremented in vtterm_cnprobe() to avoid being released by font load from
|
||||
* userland.
|
||||
*/
|
||||
static struct vt_font *
|
||||
parse_font_info(struct font_info *fi)
|
||||
{
|
||||
@ -1528,8 +1536,6 @@ parse_font_info(struct font_info *fi)
|
||||
ptr = roundup2(ptr, 8);
|
||||
|
||||
vfp = &vt_font_loader;
|
||||
/* This is default font, set refcount 1 to disable removal. */
|
||||
vfp->vf_refcount = 1;
|
||||
vfp->vf_height = fi->fi_height;
|
||||
vfp->vf_width = fi->fi_width;
|
||||
for (unsigned i = 0; i < VFNT_MAPS; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user