Fix Scan crash

This PR is intended to fix issue #419 .
The problem was that the update of the GTK interface have not been perfomed by the main thread which is responsible for the UI updates. Instead the scan thread has performed the update and caused race conditions.