Fix management of line dash state

This fixes a bug reported by @oterral off-list.