fix locking of gtk thread with refresh logic