TGViewer
Telegram github commits and releases Telegram github commits and releases @tgappsupdates · 4.54K subscribers
Post #20620 64
UnigramDev/Unigram/dwrite-collection-key • c1bf81a • 2 files, +40/-11
Give the DWrite custom font collection a valid key

CreateCustomFontCollection takes the key size in bytes, but it was given
path1.size() + path2.size(), the summed character length of the two package
paths (~240) — while the key itself is a two-element array of pointers, 16
bytes. DWrite copied ~240 bytes out of a 16-byte stack array on every
PlaceholderImageHelper construction, so the key it stored was partly unrelated
stack memory, and how much varied with the install path length.

The key also pointed at two locals that die when the function returns, so the
pointers DWrite kept were dangling by the time it could hand them back to
CreateEnumeratorFromKey. The paths and the pointer array now live inside the
CustomFontLoader, which stays alive as long as it is registered, and the size
passed is sizeof that array. CustomFontFileEnumerator honours collectionKeySize
instead of assuming two entries.

Close() now unregisters the loader it registered on the shared DWrite factory,
after releasing the collection built from it. The factory is process-wide, so
without this every window thread left a loader and a custom collection on it for
the rest of the session.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

#unigram
More from @tgappsupdates
  1. Oct 12, 2026TGX-Android/Telegram-X/main • a7ce680 • 2 files, +14/-3 Fix answering call from background…
  2. Oct 12, 2026TGX-Android/Telegram-X/main • 8d2d958 • 2 files, +9/-2 Fix answering call from background…
  3. Oct 12, 2026TGX-Android/Telegram-X/main • f4bdd29 • 1 files, +10/-3 Fix passing `aapt2` arguments #tgx…
  4. Oct 12, 2026TGX-Android/Telegram-X/main • 4e2dd7e • 1 files, +1/-1 Reduce APK size #tgxandroid
  5. Oct 12, 2026TGX-Android/Telegram-X/main • fd1f52d • 5 files, +16/-16 Remove rudimentary `this` referen…
  6. Oct 12, 2026TGX-Android/Telegram-X/main • 1128e91 • 3 files, +69/-0 Optimize APK size for `latest` fla…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →