BUG: Fix possible deadlock on QObject.connect()

QObject.connect() acquires a lock on the QObject, which is
also acquired on emit() (without acquiring the GIL),
so we always need to release the GIL to prevent out-of-order
acquisition of the locks causing deadlock.

Change-Id: I1cf47a73c2b60627e322d8ef3fa4c3efdebd4c02