wayland-rs icon indicating copy to clipboard operation
wayland-rs copied to clipboard

Downgrade and upgrade of newly initialized resource has different data Arc inside

Open technobaboo opened this issue 1 year ago • 0 comments

impl Dispatch<XdgSurface, (), WaylandState> for WaylandState {
	fn request(
		state: &mut WaylandState,
		client: &Client,
		xdg_surface: &XdgSurface,
		request: xdg_surface::Request,
		xdg_surface_data: &(),
		_dhandle: &DisplayHandle,
		data_init: &mut DataInit<'_, WaylandState>,
	) {
		match request {
			xdg_surface::Request::GetToplevel { id } => {
				let toplevel = data_init.init(id, ());
				let test_d = toplevel.downgrade();
				let test_u = test_d.upgrade().unwrap();
				let test_da = test_u.data::<()>().unwrap();
			}
		}
	}
}

is a minimal example to reproduce the problem, toplevel has a different arc pointer than test_u and test_da will panic. From what I can tell this applies to all resources.

technobaboo avatar Apr 23 '23 22:04 technobaboo