Avoid crashing race condition.

Change-Id: I940bcbc509a689804a02f71af45f5efc19bccf9f
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Merge pull request #8 from sletta/mer-stable

[qtwayland] Avoid crashing race condition.