app_server: Scan fonts in the looper thread.

This way, the first unlucky application to request the font list
after paths change (or on first app_server startup) will not stall out
while the font list is rebuilt, at least most of the time.

Should fix #17574.
This commit is contained in:
Augustin Cavalier 2022-02-10 16:44:27 -05:00
parent bde40eceef
commit 576440062d

View File

@ -126,6 +126,9 @@ FontManager::FontManager()
// Precache the plain and bold fonts
_PrecacheFontFile(fDefaultPlainFont.Get());
_PrecacheFontFile(fDefaultBoldFont.Get());
// Post a message so we scan the initial paths.
PostMessage(B_PULSE);
}
}
}
@ -297,6 +300,9 @@ FontManager::MessageReceived(BMessage* message)
break;
}
// Scan fonts here if we need to, preventing other threads from having to do so.
_ScanFontsIfNecessary();
BLooper::MessageReceived(message);
}