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)
|
self.remove_page(0)
|
||||||
parent = self.get_parent()
|
parent = self.get_parent()
|
||||||
parent.remove(self)
|
parent.remove(self)
|
||||||
|
self.cnxids.remove_all()
|
||||||
parent.add(child)
|
parent.add(child)
|
||||||
del(self)
|
del(self)
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ class Paned(Container):
|
||||||
|
|
||||||
parent = self.get_parent()
|
parent = self.get_parent()
|
||||||
parent.remove(self)
|
parent.remove(self)
|
||||||
|
self.cnxids.remove_all()
|
||||||
parent.add(sibling)
|
parent.add(sibling)
|
||||||
del(self)
|
del(self)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -30,6 +30,7 @@ class Signalman(object):
|
||||||
|
|
||||||
self.cnxids[widget][signal] = widget.connect(signal, handler, *args)
|
self.cnxids[widget][signal] = widget.connect(signal, handler, *args)
|
||||||
dbg('connected %s::%s to %s' % (type(widget), signal, handler))
|
dbg('connected %s::%s to %s' % (type(widget), signal, handler))
|
||||||
|
return(self.cnxids[widget][signal])
|
||||||
|
|
||||||
def remove_signal(self, widget, signal):
|
def remove_signal(self, widget, signal):
|
||||||
"""Remove a signal handler"""
|
"""Remove a signal handler"""
|
||||||
|
@ -55,3 +56,9 @@ class Signalman(object):
|
||||||
for signal in signals:
|
for signal in signals:
|
||||||
self.remove_signal(widget, signal)
|
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):
|
def on_destroy_event(self, widget, data=None):
|
||||||
"""Handle window descruction"""
|
"""Handle window descruction"""
|
||||||
|
self.cnxids.remove_all()
|
||||||
self.terminator.deregister_window(self)
|
self.terminator.deregister_window(self)
|
||||||
self.destroy()
|
self.destroy()
|
||||||
del(self)
|
del(self)
|
||||||
|
|
Loading…
Reference in New Issue