mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
baseclass: Log if emit() called from non-MainThread
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
5e63e87a8a
commit
9346c22134
@ -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 #
|
||||
|
Loading…
Reference in New Issue
Block a user