Fix #10339 (crash when reordering layers)

This was caused by the recent addition of currentNode handling in model.
Changed to use persistent indices which are auto-updated when model changes.