Fixed issue on emitting a signal which will change a table before the click has returned, which can crash Python

svn: r13946
This commit is contained in:
Doug Blank 2009-12-31 14:56:44 +00:00
parent c269b45a46
commit fa1413c640

View File

@ -168,8 +168,13 @@ class SimpleTable(object):
elif self.__link[index]:
objclass, handle = self.__link[index]
if objclass == 'Person':
import gobject
person = self.access.dbase.get_person_from_handle(handle)
self.simpledoc.doc.dbstate.change_active_person(person)
# If you emmit the signal here and it causes this table to be deleted,
# then you'll crash Python:
#self.simpledoc.doc.dbstate.change_active_person(person)
# So, let's return from this, then change the active person:
gobject.timeout_add(100, self.simpledoc.doc.dbstate.change_active_person, person)
return True
return False # didn't handle event