def timeout_cb(self): ag0 = self.ag0 uimanager = self.uimanager del self.ag0, self.uimanager uimanager.remove_ui(self.merge_id0) uimanager.remove_action_group(ag0) if gobject.pygobject_version >= (2, 13): ag0ref = ag0.weak_ref() del ag0 self.assertEqual(ag0ref(), None) else: gc.collect() # Clean out unreachable objects del ag0 self.assertEqual(gc.collect(), 1) # Collect just the ActionGroup uimanager.ensure_update() self.assertEqual(gc.collect(), 6) # Now the GtkActions have lost their last # GObject reference; they should be collected. # We have a ToggleAction, an Action and a # RadioAction, plus self.cb is bound in three # closures. gtk.main_quit()
def quit(_): gtk.main_quit()
def leak_check(self, objref, windowref): while gc.collect(): pass gtk.main_quit() self.assertEqual(objref(), None) self.windowref = windowref