servo / dwrote-rs

DirectWrite bindings and wrapper for Rust
11 stars 13 forks source link

ensure FontFileStream is cleaned up with its owning FontFile #22

Closed lsalzman closed 6 years ago

lsalzman commented 6 years ago

When FontFile::new_from_data is used, a FontFileStream is created and placed in a global HashMap that is never cleaned up. We only want the FontFileStream to live as long as the FontFile itself does.

Further, the API passes in a data slice to FontFile::new_from_data which is copied into FontFileStream, contributing to memory bloat. This modifies the API to use an Arc instead, so that the data can be properly shared.

gw3583 commented 6 years ago

@bors-servo r+

It'd be nice when we have some time to follow up with some details on the AddRef changes.

bors-servo commented 6 years ago

:pushpin: Commit f4cda07 has been approved by gw3583

bors-servo commented 6 years ago

:hourglass: Testing commit f4cda07fef5b51d277b9e57a2d16eee123ad8e27 with merge ac8ae4bfe8d12c4202ed5acbcaf1482f79244ba7...

bors-servo commented 6 years ago

:sunny: Test successful - status-appveyor Approved by: gw3583 Pushing ac8ae4bfe8d12c4202ed5acbcaf1482f79244ba7 to master...