Take care of failure of XQueryTree() to prevent it from causing a double-free crash. This usually happens when X is initializing and windows are constantly changing.