Make sure events don't fire after listener is removed.

This patch fixes a problem with a dangling  event listener, which is
called even after it has been removed. This situation can occur when a
listener is removed during an even dispatch.

To fix this problem, the old action is replaced with a NOOP, so that
when the listener is being fired, it is not the old listener but the
NOOP.
Merge pull request #1661 from spamdaemon/FIX_1654

Make sure events don't fire after listener is removed.