Fix body/icon pointing to garbage

The pattern matching moves 'body' and drops it after
creation of the pointer. We must avoid the move, by using 'ref'.
This commit is contained in:
2017-07-09 12:51:55 +02:00
parent 5ab8f64e88
commit 7d80600657

View File

@@ -130,7 +130,7 @@ impl Context {
None => None,
};
let body_ptr = match body {
Some(body) => body.as_ptr(),
Some(ref body) => body.as_ptr(),
None => std::ptr::null(),
};
let icon = match icon {
@@ -138,9 +138,10 @@ impl Context {
None => None,
};
let icon_ptr = match icon {
Some(icon) => icon.as_ptr(),
Some(ref icon) => icon.as_ptr(),
None => std::ptr::null(),
};
unsafe {
let n = sys::notify_notification_new(summary.as_ptr(), body_ptr, icon_ptr);
if n.is_null() {