Fix possible stack overflow for notifyIdle<->processEvents.

Fixes a regression introduced by 98024b4e6294035ea823dcf23f18f6343ec2540c/e1d0ec476bcc7121da35d11e77841efb4512462c.