From 1755568b30fdb16070d481f2dc25b75838853f21 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Tue, 28 Oct 2014 13:29:58 +1000 Subject: Fix a few more string memory issues. --- src/x11/window/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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")); -- cgit v1.2.3