Fix command stack action destruction

The command stack actions set up a listener to the undo manager
in order to dynamically change the name of the menu item
depending on the command that is at the top of stack.

The listener was not removed when the action is destroyed, which
caused problems when a menu bar is re-built.