Added handling for XCB_DESTROY_NOTIFY events, and fixed bugs in list.h

When I close my eyes all I see are segfaults.