Browse Source

fixed crash in _ignore

Darren Ranalli 19 years ago
parent
commit
823340c46c
1 changed files with 3 additions and 4 deletions
  1. 3 4
      direct/src/controls/InputState.py

+ 3 - 4
direct/src/controls/InputState.py

@@ -66,7 +66,7 @@ class InputState(DirectObject.DirectObject):
         # tables to look up the info needed to undo operations
         # tables to look up the info needed to undo operations
         self._token2inputSource = {}
         self._token2inputSource = {}
         self._token2forceInfo = {}
         self._token2forceInfo = {}
-        # inputSource->token->(eventOn, eventOff)
+        # inputSource->token->(name, eventOn, eventOff)
         self._watching = {}
         self._watching = {}
         assert self.debugPrint("InputState()")
         assert self.debugPrint("InputState()")
 
 
@@ -139,7 +139,7 @@ class InputState(DirectObject.DirectObject):
         token.accept(eventOff, self.set, [name, False, inputSource])
         token.accept(eventOff, self.set, [name, False, inputSource])
         self._token2inputSource[token] = inputSource
         self._token2inputSource[token] = inputSource
         self._watching.setdefault(inputSource, {})
         self._watching.setdefault(inputSource, {})
-        self._watching[inputSource][token] = (eventOn, eventOff)
+        self._watching[inputSource][token] = (name, eventOn, eventOff)
         return token
         return token
 
 
     def watchWithModifiers(self, name, event, startState=False, inputSource=None):
     def watchWithModifiers(self, name, event, startState=False, inputSource=None):
@@ -155,9 +155,8 @@ class InputState(DirectObject.DirectObject):
         Undo a watch(). Don't call this directly, call release() on the token that watch() returned.
         Undo a watch(). Don't call this directly, call release() on the token that watch() returned.
         """
         """
         inputSource = self._token2inputSource.pop(token)
         inputSource = self._token2inputSource.pop(token)
-        eventPair = self._watching[inputSource].pop(token)
+        name, eventOn, eventOff = self._watching[inputSource].pop(token)
         token.invalidate()
         token.invalidate()
-        eventOn, eventOff = eventPair
         DirectObject.DirectObject.ignore(self, eventOn)
         DirectObject.DirectObject.ignore(self, eventOn)
         DirectObject.DirectObject.ignore(self, eventOff)
         DirectObject.DirectObject.ignore(self, eventOff)
         if len(self._watching[inputSource]) == 0:
         if len(self._watching[inputSource]) == 0: