title: XCloseDisplay hangs
body: <p>I'm working on a small self-written window manager, the project is at the very beginning and there are just a few lines of code communicating with the X server. The problem comes at exit: the program hangs when XCloseDisplay is called.</p>
  
  <p>There is no window manager running while testing, the program just initializes some features, gets the screens and the available windows, call XSelectEvent on the default root and prints out the number of windows retrieved. Then it cleans it's internal data and tries to close the connection with the X server.</p>
  
  <p>At that point it hangs until killed.</p>