aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11/window/mod.rs
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2014-10-27 07:14:34 +0100
committertomaka <pierre.krieger1708@gmail.com>2014-10-27 07:14:34 +0100
commit03c55230f0ecbf0ac2fff1a0ca2248ebdafe5215 (patch)
treefc5d1815376a6b873d2f737cacd00d160e6b85fa /src/x11/window/mod.rs
parent41d7118a424513e658279df877eafd4421e10dc3 (diff)
parent7800b1474986d6837ca87b8dc67465140c4d75f0 (diff)
downloadglutin-03c55230f0ecbf0ac2fff1a0ca2248ebdafe5215.tar.gz
glutin-03c55230f0ecbf0ac2fff1a0ca2248ebdafe5215.zip
Merge pull request #75 from glennw/fix-x11-window-title
Fix bad memory being passed (due to going out of scope) to set title on X11.
Diffstat (limited to 'src/x11/window/mod.rs')
-rw-r--r--src/x11/window/mod.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index 99cbf9d..c2381fd 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -168,7 +168,8 @@ impl Window {
let mut wm_delete_window = ffi::XInternAtom(display,
"WM_DELETE_WINDOW".to_c_str().as_ptr() as *const libc::c_char, 0);
ffi::XSetWMProtocols(display, window, &mut wm_delete_window, 1);
- ffi::XStoreName(display, window, mem::transmute(builder.title.as_slice().as_ptr()));
+ let c_title = builder.title.to_c_str();
+ ffi::XStoreName(display, window, c_title.as_ptr());
ffi::XFlush(display);
wm_delete_window
@@ -277,9 +278,10 @@ impl Window {
}
pub fn set_title(&self, title: &str) {
+ let c_title = title.to_c_str();
unsafe {
- ffi::XStoreName(self.display, self.window,
- mem::transmute(title.as_slice().as_ptr()));
+ ffi::XStoreName(self.display, self.window, c_title.as_ptr());
+ ffi::XFlush(self.display);
}
}