Use SendCell::try_get instead of SendCell::into_inner
This commit is contained in:
parent
6071c664e7
commit
710a3f2552
@ -179,8 +179,10 @@ pub fn set_image_from_path(
|
|||||||
if let Some(px) = hashmap.get(&(pd.id(), size)) {
|
if let Some(px) = hashmap.get(&(pd.id(), size)) {
|
||||||
let m = px.lock()
|
let m = px.lock()
|
||||||
.map_err(|_| format_err!("Failed to lock pixbuf mutex."))?;
|
.map_err(|_| format_err!("Failed to lock pixbuf mutex."))?;
|
||||||
let px = m.clone().into_inner();
|
let px = m.try_get().ok_or_else(|| {
|
||||||
image.set_from_pixbuf(&px);
|
format_err!("Pixbuf was accessed from a different thread than created")
|
||||||
|
})?;
|
||||||
|
image.set_from_pixbuf(px);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user