aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2014-10-28 13:29:58 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2014-10-28 13:33:04 +1000
commit1755568b30fdb16070d481f2dc25b75838853f21 (patch)
tree36595bcd569963bd14e02ad5d700123f9a0398c2
parent0392dc697ae4d96374be52fc98431cb91c46840e (diff)
downloadglutin-1755568b30fdb16070d481f2dc25b75838853f21.tar.gz
glutin-1755568b30fdb16070d481f2dc25b75838853f21.zip
Fix a few more string memory issues.
-rw-r--r--src/x11/window/mod.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index d69feab..4cb405f 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -166,9 +166,9 @@ impl Window {
let wm_delete_window = unsafe {
use std::c_str::ToCStr;
+ let delete_window = "WM_DELETE_WINDOW".to_c_str();
ffi::XMapWindow(display, window);
- let mut wm_delete_window = ffi::XInternAtom(display,
- "WM_DELETE_WINDOW".to_c_str().as_ptr() as *const libc::c_char, 0);
+ let mut wm_delete_window = ffi::XInternAtom(display, delete_window.as_ptr(), 0);
ffi::XSetWMProtocols(display, window, &mut wm_delete_window, 1);
let c_title = builder.title.to_c_str();
ffi::XStoreName(display, window, c_title.as_ptr());
@@ -190,8 +190,10 @@ impl Window {
let ic = unsafe {
use std::c_str::ToCStr;
- let ic = ffi::XCreateIC(im, "inputStyle".to_c_str().as_ptr(),
- ffi::XIMPreeditNothing | ffi::XIMStatusNothing, "clientWindow".to_c_str().as_ptr(),
+ let input_style = "inputStyle".to_c_str();
+ let client_window = "clientWindow".to_c_str();
+ let ic = ffi::XCreateIC(im, input_style.as_ptr(),
+ ffi::XIMPreeditNothing | ffi::XIMStatusNothing, client_window.as_ptr(),
window, ptr::null());
if ic.is_null() {
return Err(format!("XCreateIC failed"));