Fixed a bug where the GetAndClear method in EventQueue would never terminate.