From 3c5c5a47f3eb1a4c74fb10a62669a1087e90fa85 Mon Sep 17 00:00:00 2001 From: Timidger Date: Wed, 30 May 2018 22:04:24 -0700 Subject: [PATCH] Removed InternalLayerSurfaceState --- src/types/shell/layer_shell.rs | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/types/shell/layer_shell.rs b/src/types/shell/layer_shell.rs index f5a74e27..a6119282 100644 --- a/src/types/shell/layer_shell.rs +++ b/src/types/shell/layer_shell.rs @@ -27,11 +27,6 @@ use errors::{HandleErr, HandleResult}; use {SurfaceHandle, OutputHandle}; -/// Used to reconstruct `LayerSurfaceHandle`s from raw pointers. -struct InternalLayerSurfaceState { - handle: Weak> -} - #[derive(Debug)] pub struct LayerSurface { liveliness: Rc>, @@ -117,8 +112,6 @@ impl LayerSurface { panic!("Layer surface had a null output") } let liveliness = Rc::new(Cell::new(false)); - let state = Box::new(InternalLayerSurfaceState { handle: Rc::downgrade(&liveliness) }); - (*layer_surface).data = Box::into_raw(state) as *mut _; LayerSurface { liveliness, layer_surface } } @@ -282,9 +275,6 @@ impl Drop for LayerSurface { fn drop(&mut self) { if Rc::strong_count(&self.liveliness) == 1 { wlr_log!(L_DEBUG, "Dropped Layer Shell Surface {:p}", self.layer_surface); - unsafe { - let _ = Box::from_raw((*self.layer_surface).data as *mut InternalLayerSurfaceState); - } let weak_count = Rc::weak_count(&self.liveliness); if weak_count > 0 { wlr_log!(L_DEBUG, @@ -308,17 +298,6 @@ impl LayerSurfaceHandle { } } - /// Creates a LayerSurfaceHandle from the raw pointer, using the saved - /// user data to recreate the memory model. - pub(crate) unsafe fn from_ptr(layer_surface: *mut wlr_layer_surface) -> Self { - let data = (*layer_surface).data as *mut InternalLayerSurfaceState; - if data.is_null() { - panic!("Layer surface has not been setup properly!"); - } - let handle = (*data).handle.clone(); - LayerSurfaceHandle { handle, layer_surface } - } - /// Upgrades the wayland shell handle to a reference to the backing `LayerSurface`. /// /// # Unsafety