Try to prevent unbalanced flushing

Now use -isFlushWindowDisabled instead of our own ivar to guard
against unbalanced disable/enable calls. @synchronized is used
to avoid race conditions. Not sure if it would work, but certainly
looks better than before.

Fix #173