The issue is that when there is nothing on the Undo stack, the GTK Action for Undo is disabled, so Ctrl-Z is no longer a valid keyboard shortcut. Hence it is not captured and gets passed to the Text tool. The fix is probably to have the Text tool ignore either this combination, or all key presses when the Ctrl key is down (probably the latter makes more sense).
The issue is that when there is nothing on the Undo stack, the GTK Action for Undo is disabled, so Ctrl-Z is no longer a valid keyboard shortcut. Hence it is not captured and gets passed to the Text tool. The fix is probably to have the Text tool ignore either this combination, or all key presses when the Ctrl key is down (probably the latter makes more sense).