Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
I suppose the relevant question is, *should* it be thread safe. I don't know. That said, I suspect many people think that it IS thread safe, e.g. this stackoverflow question suggests that using Bitmap/etc. from a non-UI thread should be fine, within the context of a question that mentions Typeface.create():
The problem is that Typeface.create() isn't thread safe. At all.
For example, Typeface.java contains no `synchronized` code:
Furthermore, Typeface.create() calls sTypefaceCache.put() on line 160, which raises the question: is sTypefaceCache.put() thread safe?
sTypefaceCache is a LongSparseArray<E>, and LongSparseArray<E> isn't thread safe either:
Again, no `synchronized` in sight, and put() contains no other form of locking either.
If Typeface.create() is called concurrently from multiple threads, all bets at sane behavior are off.
At minimum, could this at least be *documented*?
Even better, could Typeface.create() and company be made properly thread safe?