Skip to content

Commit 7684cd1

Browse files
committed
render: Fix shader obj leak
1 parent a0f8c4e commit 7684cd1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/backend/render/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use smithay::{
4949
constrain_render_elements, ConstrainAlign, ConstrainScaleBehavior,
5050
CropRenderElement, Relocate, RelocateRenderElement, RescaleRenderElement,
5151
},
52-
Element, Id, Kind, RenderElement,
52+
Element, Id, Kind, RenderElement, WeakId,
5353
},
5454
gles::{
5555
element::{PixelShaderElement, TextureShaderElement},
@@ -132,7 +132,7 @@ pub enum Usage {
132132

133133
#[derive(Clone)]
134134
pub enum Key {
135-
Static(Id),
135+
Static(WeakId),
136136
Group(Weak<()>),
137137
Window(Usage, CosmicMappedKey),
138138
}
@@ -166,7 +166,7 @@ impl From<WindowGroup> for Key {
166166
}
167167
impl From<Id> for Key {
168168
fn from(id: Id) -> Self {
169-
Key::Static(id)
169+
Key::Static(id.downgrade())
170170
}
171171
}
172172

@@ -236,7 +236,7 @@ impl IndicatorShader {
236236
user_data.insert_if_missing(|| IndicatorCache::new(HashMap::new()));
237237
let mut cache = user_data.get::<IndicatorCache>().unwrap().borrow_mut();
238238
cache.retain(|k, _| match k {
239-
Key::Static(_) => true,
239+
Key::Static(w) => w.upgrade().is_some(),
240240
Key::Group(w) => w.upgrade().is_some(),
241241
Key::Window(_, w) => w.alive(),
242242
});
@@ -318,7 +318,7 @@ impl BackdropShader {
318318
user_data.insert_if_missing(|| BackdropCache::new(HashMap::new()));
319319
let mut cache = user_data.get::<BackdropCache>().unwrap().borrow_mut();
320320
cache.retain(|k, _| match k {
321-
Key::Static(_) => true,
321+
Key::Static(w) => w.upgrade().is_some(),
322322
Key::Group(a) => a.upgrade().is_some(),
323323
Key::Window(_, w) => w.alive(),
324324
});

src/shell/layout/tiling/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5286,7 +5286,7 @@ where
52865286
swap_elements.push(CosmicMappedRenderElement::FocusIndicator(
52875287
IndicatorShader::focus_element(
52885288
renderer,
5289-
Key::Static(swapping_stack_surface_id.clone()),
5289+
Key::from(swapping_stack_surface_id.clone()),
52905290
swap_geo,
52915291
4,
52925292
transition.unwrap_or(1.0),

0 commit comments

Comments
 (0)