TreeView::restoreOpennessState misbehaving?

To make it easier to investigate this issue I've made a git patch. This patch applied to the latest tip should demonstrate the problem. After applying the patch, run the Dialogs demo and bring up the save file dialog.