Author: bugman Date: Thu May 10 20:12:13 2012 New Revision: 16208 URL: http://svn.gna.org/viewcvs/relax?rev=16208&view=rev Log: Fix for the post_reset() method of the Analysis_controller object. This unregisters all the analyses from the observer objects, and calls the set_init_state() method only once all analysis pages are deleted. This in combination with the synchronous reset user function calling prevents the GUI from blowing up! Modified: branches/uf_redesign/gui/analyses/__init__.py Modified: branches/uf_redesign/gui/analyses/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/analyses/__init__.py?rev=16208&r1=16207&r2=16208&view=diff ============================================================================== --- branches/uf_redesign/gui/analyses/__init__.py (original) +++ branches/uf_redesign/gui/analyses/__init__.py Thu May 10 20:12:13 2012 @@ -636,6 +636,21 @@ def post_reset(self): """Post relax data store reset event handler.""" + # Debugging set up. + if status.debug: + fn_name = sys._getframe().f_code.co_name + mod_name = inspect.getmodule(inspect.stack()[1][0]).__name__ + class_name = self.__class__.__name__ + full_name = "%s.%s.%s" % (mod_name, class_name, fn_name) + print("\n\n") + print("debug> %s: Deleting all analyses." % full_name) + + # Unregister all observer objects prior to analysis deletion. This is to prevent queued wx events being sent to dead or non-existent objects. + if status.debug: + print("debug> %s: Unregistering all methods with the observer objects." % full_name) + for i in range(self._num_analyses): + self._analyses[i].observer_register(remove=True) + # Delete all tabs. while self._num_analyses: # The index of the tab to remove. @@ -651,8 +666,8 @@ # Decrement the number of analyses. self._num_analyses -= 1 - # Set the initial state. - self.set_init_state() + # Set the initial state. + self.set_init_state() def set_init_state(self):