prevent deadlocks between main thread and other thread processing a Qt event

This part of 13a34f4c6307d1bd2443cbf3fbd83bfdd8cdbafb was correct. The main
thread will deadlock on the yield mutex if the calling thread does not release
it before waiting on the main thread.

Change-Id: I6692473457258b791c131e8bdb459b06b01550f7