Skip to content

Commit f5b0c6d

Browse files
authored
Call XCloseDisplay instead of xcb_disconnect (#184)
1 parent 70e7af6 commit f5b0c6d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/x11/xcb_connection.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl XcbConnection {
4040
let xcb_connection = unsafe { xlib_xcb::XGetXCBConnection(dpy) };
4141
assert!(!xcb_connection.is_null());
4242
let screen = unsafe { xlib::XDefaultScreen(dpy) } as usize;
43-
let conn = unsafe { XCBConnection::from_raw_xcb_connection(xcb_connection, true)? };
43+
let conn = unsafe { XCBConnection::from_raw_xcb_connection(xcb_connection, false)? };
4444
unsafe {
4545
xlib_xcb::XSetEventQueueOwner(dpy, xlib_xcb::XEventQueueOwner::XCBOwnsEventQueue)
4646
};
@@ -119,3 +119,11 @@ impl XcbConnection {
119119
&self.conn.setup().roots[self.screen]
120120
}
121121
}
122+
123+
impl Drop for XcbConnection {
124+
fn drop(&mut self) {
125+
unsafe {
126+
xlib::XCloseDisplay(self.dpy);
127+
}
128+
}
129+
}

0 commit comments

Comments
 (0)