Skip to content

Commit

Permalink
Call XCloseDisplay instead of xcb_disconnect (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
micahrj authored Mar 29, 2024
1 parent 70e7af6 commit f5b0c6d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/x11/xcb_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl XcbConnection {
let xcb_connection = unsafe { xlib_xcb::XGetXCBConnection(dpy) };
assert!(!xcb_connection.is_null());
let screen = unsafe { xlib::XDefaultScreen(dpy) } as usize;
let conn = unsafe { XCBConnection::from_raw_xcb_connection(xcb_connection, true)? };
let conn = unsafe { XCBConnection::from_raw_xcb_connection(xcb_connection, false)? };
unsafe {
xlib_xcb::XSetEventQueueOwner(dpy, xlib_xcb::XEventQueueOwner::XCBOwnsEventQueue)
};
Expand Down Expand Up @@ -119,3 +119,11 @@ impl XcbConnection {
&self.conn.setup().roots[self.screen]
}
}

impl Drop for XcbConnection {
fn drop(&mut self) {
unsafe {
xlib::XCloseDisplay(self.dpy);
}
}
}

0 comments on commit f5b0c6d

Please sign in to comment.