mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Make add_panic_object in thread.rs borrow rather than own the object.
This commit is contained in:
parent
2b910678db
commit
941093d983
1 changed files with 2 additions and 2 deletions
|
@ -57,7 +57,7 @@ pub fn spawn_named<F>(name: String, f: F)
|
||||||
|
|
||||||
pub trait AddFailureDetails {
|
pub trait AddFailureDetails {
|
||||||
fn add_panic_message(&mut self, message: String);
|
fn add_panic_message(&mut self, message: String);
|
||||||
fn add_panic_object(&mut self, object: Box<Any>) {
|
fn add_panic_object(&mut self, object: &Any) {
|
||||||
if let Some(message) = object.downcast_ref::<String>() {
|
if let Some(message) = object.downcast_ref::<String>() {
|
||||||
self.add_panic_message(message.to_owned());
|
self.add_panic_message(message.to_owned());
|
||||||
} else if let Some(&message) = object.downcast_ref::<&'static str>() {
|
} else if let Some(&message) = object.downcast_ref::<&'static str>() {
|
||||||
|
@ -111,7 +111,7 @@ pub fn spawn_named_with_send_on_failure<F, T, S>(name: String,
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
debug!("{} failed, notifying constellation", name);
|
debug!("{} failed, notifying constellation", name);
|
||||||
msg.add_panic_object(err);
|
msg.add_panic_object(&*err);
|
||||||
dest.send_on_failure(S::Value::from(msg));
|
dest.send_on_failure(S::Value::from(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue