playdate icon indicating copy to clipboard operation
playdate copied to clipboard

check ptr is aligned to `UD`

Open github-actions[bot] opened this issue 9 months ago • 0 comments

source

	pub(crate) fn take_userdata(&self) -> Option<Box<Userdata>> {
		let f = self.1.get_userdata();
		let ptr = unsafe { f(self.0) };
		if ptr.is_null() {
			None
		} else {
			// TODO: check ptr is aligned to `UD`
			let ud = unsafe { Box::from_raw(ptr as *mut Userdata) };
			Some(ud)
		}
	}

github-actions[bot] avatar Sep 20 '23 11:09 github-actions[bot]