Call Signalman::remove_all() when each of the Container subclasses commits suicide. SHould stop any stale signal handler connections existing
This commit is contained in:
parent
8d8681e63f
commit
23ccad813d
|
@ -266,6 +266,7 @@ class Notebook(Container, gtk.Notebook):
|
|||
self.remove_page(0)
|
||||
parent = self.get_parent()
|
||||
parent.remove(self)
|
||||
self.cnxids.remove_all()
|
||||
parent.add(child)
|
||||
del(self)
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ class Paned(Container):
|
|||
|
||||
parent = self.get_parent()
|
||||
parent.remove(self)
|
||||
self.cnxids.remove_all()
|
||||
parent.add(sibling)
|
||||
del(self)
|
||||
else:
|
||||
|
|
|
@ -30,6 +30,7 @@ class Signalman(object):
|
|||
|
||||
self.cnxids[widget][signal] = widget.connect(signal, handler, *args)
|
||||
dbg('connected %s::%s to %s' % (type(widget), signal, handler))
|
||||
return(self.cnxids[widget][signal])
|
||||
|
||||
def remove_signal(self, widget, signal):
|
||||
"""Remove a signal handler"""
|
||||
|
@ -55,3 +56,9 @@ class Signalman(object):
|
|||
for signal in signals:
|
||||
self.remove_signal(widget, signal)
|
||||
|
||||
def remove_all(self):
|
||||
"""Remove all signal handlers for all widgets"""
|
||||
widgets = self.cnxids.keys()
|
||||
for widget in widgets:
|
||||
self.remove_widget(widget)
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ class Window(Container, gtk.Window):
|
|||
|
||||
def on_destroy_event(self, widget, data=None):
|
||||
"""Handle window descruction"""
|
||||
self.cnxids.remove_all()
|
||||
self.terminator.deregister_window(self)
|
||||
self.destroy()
|
||||
del(self)
|
||||
|
|
Loading…
Reference in New Issue