Prevent infinite loop if notify callback triggers a click event

Possible solution for bug #309