Fix ref/locking behaviour of gs_app_get_version_history()
See the commit messages. Essentially the version history could be modified from one thread while it was being queried and used in another; add a strong ref and some locking to fix that.
Fixes: #1227 (closed)