diff options
author | Cole Robinson <crobinso@redhat.com> | 2020-01-15 14:38:24 -0500 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2020-01-15 15:19:55 -0500 |
commit | 9346c22134f728617eab1322da679febf4bf54ef (patch) | |
tree | eea25102f7722dea3abcbcb34c39820a086149a6 | |
parent | 5e63e87a8a13b0f2f325519f9f1f69d3a0f74821 (diff) | |
download | virt-manager-9346c22134f728617eab1322da679febf4bf54ef.tar.gz |
baseclass: Log if emit() called from non-MainThread
Signed-off-by: Cole Robinson <crobinso@redhat.com>
-rw-r--r-- | virtManager/baseclass.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/virtManager/baseclass.py b/virtManager/baseclass.py index b2c90263..5722c56f 100644 --- a/virtManager/baseclass.py +++ b/virtManager/baseclass.py @@ -171,6 +171,10 @@ class vmmGObject(GObject.GObject): """ GObject emit() wrapper to simplify callers """ + if not self._is_main_thread(): + log.error("emitting signal from non-main thread. This is a bug " + "please report it. thread=%s self=%s signal=%s", + self._thread_name(), self, signal_name) return GObject.GObject.emit(self, signal_name, *args) def add_gsettings_handle(self, handle): @@ -207,6 +211,12 @@ class vmmGObject(GObject.GObject): t.daemon = True t.start() + def _thread_name(self): + return threading.current_thread().name + + def _is_main_thread(self): + return self._thread_name() == "MainThread" + ############################## # Custom signal/idle helpers # |