Make events flush during query processing.

Previously we would queue up all events and flush them all at once
after evalaution of a query had occurred. This is bad for initial
query processing because it can generate huge queues and a long wait
time. Instead, check the size of the queue on each iteration and flush
the current queue when a maximum is reached.
Fix warning for uninitialized data in ZernikeDescriptor.