Fixed performance issue when extending the selection many times (the selection stack was growing more and more)