Skip to content

Commit

Permalink
fn <Rav1dUserData as From<Dav1dUserData>>::from: Add // SAFETY co…
Browse files Browse the repository at this point in the history
…mment for `CArc::from_raw`.
  • Loading branch information
kkysen committed Jul 16, 2024
1 parent 570e65f commit 3292eb3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/dav1d/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ pub(crate) type Rav1dUserData = Option<CArc<u8>>;
impl From<Dav1dUserData> for Rav1dUserData {
fn from(value: Dav1dUserData) -> Self {
let Dav1dUserData { data: _, r#ref } = value;
r#ref.map(|r#ref| unsafe { CArc::from_raw(r#ref) })
r#ref.map(|r#ref| {
// SAFETY: `r#ref` came from `CArc::into_raw`.
unsafe { CArc::from_raw(r#ref) }
})
}
}

Expand Down

0 comments on commit 3292eb3

Please sign in to comment.