Author: bugman Date: Tue Jun 11 18:09:23 2013 New Revision: 20046 URL: http://svn.gna.org/viewcvs/relax?rev=20046&view=rev Log: Merged revisions 20045 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r20045 | bugman | 2013-06-11 18:07:12 +0200 (Tue, 11 Jun 2013) | 9 lines Big bug fix - the relax execution lock now truly supports nesting. This fixes bug #20891 (https://gna.org/bugs/?20891) reported by Troels Linnet (https://gna.org/users/tlinnet). Scripts can now be executed from the GUI. Note that this is a very dangerous fix. Playing with the relax execution lock often proves fatal, so this commit may have to be reverted. ........ Modified: branches/relax_disp/ (props changed) branches/relax_disp/status.py Propchange: branches/relax_disp/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Tue Jun 11 18:09:23 2013 @@ -1,1 +1,1 @@ -/trunk:1-20043 +/trunk:1-20045 Modified: branches/relax_disp/status.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/status.py?rev=20046&r1=20045&r2=20046&view=diff ============================================================================== --- branches/relax_disp/status.py (original) +++ branches/relax_disp/status.py Tue Jun 11 18:09:23 2013 @@ -246,11 +246,11 @@ self._status = Status() # The name and mode of the locker. - self._name = None - self._mode = None + self._name = [] + self._mode = [] # Script nesting level. - self._script_nest = 0 + self._nest = 0 # Auto-analysis from script launch. self._auto_from_script = False @@ -273,39 +273,26 @@ if self._status.debug: sys.stdout.write("debug> Execution lock: Acquisition by '%s' ('%s' mode).\n" % (name, mode)) - # Do not acquire if lunching a script from a script. - if mode == 'script' and self._mode == 'script' and self.locked(): + # Store the new name and mode. + self._name.append(name) + self._mode.append(mode) + + # Nested locking. + if self.locked(): # Increment the nesting counter. - self._script_nest += 1 + self._nest += 1 # Debugging. if self._fake_lock: - self.log.write("Nested by %s (to level %s)\n" % (name, self._script_nest)) + self.log.write("Nested by %s (to level %s)\n" % (name, self._nest)) self.log.flush() # Return without doing anything. return - # Skip locking if an auto-analysis is called from a script. - if self.locked() and self._mode == 'script' and mode == 'auto-analysis': - # Debugging. - if self._fake_lock: - self.log.write("Skipped unlocking of '%s' lock by '%s'\n" % (self._name, name)) - self.log.flush() - - # Switch the flag. - self._auto_from_script = True - - # Return without doing anything. - return - - # Store the new name and mode. - self._name = name - self._mode = mode - # Debugging. if self._fake_lock: - self.log.write("Acquired by %s\n" % self._name) + self.log.write("Acquired by %s\n" % self._name[-1]) self.log.flush() return @@ -325,7 +312,7 @@ # Debugging (pseudo-locking based on _name). if self._fake_lock: - if self._name: + if len(self._name): return True else: return False @@ -339,37 +326,24 @@ # Debugging. if self._status.debug: - sys.stdout.write("debug> Execution lock: Release by '%s' ('%s' mode).\n" % (self._name, self._mode)) - - # Nested scripting. - if self._script_nest: + sys.stdout.write("debug> Execution lock: Release by '%s' ('%s' mode).\n" % (self._name[-1], self._mode[-1])) + + # Pop the name and mode. + self._name.pop(-1) + self._mode.pop(-1) + + # Nested locking. + if self._nest: # Debugging. if self._fake_lock: - self.log.write("Script termination, nest decrement (%s -> %s)\n" % (self._script_nest, self._script_nest-1)) + self.log.write("Nested locking decrement (%s -> %s)\n" % (self._nest, self._nest-1)) self.log.flush() # Decrement. - self._script_nest -= 1 + self._nest -= 1 # Return without releasing the lock. return - - # Auto-analysis launched from script. - if self._auto_from_script: - # Debugging. - if self._fake_lock: - self.log.write("Auto-analysis launched from script, skipping release.\n") - self.log.flush() - - # Unset the flag. - self._auto_from_script = False - - # Return without releasing the lock. - return - - # Reset the name and mode. - self._name = None - self._mode = None # Debugging. if self._fake_lock: