[Nvda-dev] commit r3427 - trunk/source

NVDA Subversion svn at nvda-project.org
Tue Dec 8 07:05:06 UTC 2009


Author: bzr
Date: Tue Dec  8 07:05:06 2009
New Revision: 3427

Log:
When collecting the ancestors of the focus: bail out if there are more than 100 of them as this most likely means there is a loop or some other bad implementation of parent in the underlying accessibility hierarchy. This fix is most useful in Microsoft Outlook 2003 where due to a bad implementation of accParent on the message viewer control, NVDA would freeze due to an infinit number of focus ancestors. This is not a perfect fix for Outlook as there still is a short delay until it breaks out of the loop, and NVDA in non-release builds will also play the error sound due to logging this error. But, at least now the freeze is finally gone. Fix for #134

Modified:
   trunk/source/api.py

Modified: trunk/source/api.py
==============================================================================
--- trunk/source/api.py	(original)
+++ trunk/source/api.py	Tue Dec  8 07:05:06 2009
@@ -74,7 +74,16 @@
 	focusDifferenceLevel=0
 	oldFocusLineLength=len(oldFocusLine)
 	# Starting from the focus, move up the ancestor chain.
+	safetyCount=0
 	while tempObj:
+		if safetyCount<100:
+			safetyCount+=1
+		else:
+			try:
+				log.error("Never ending focus ancestry: last object: %s, %s, window class %s, application name %s"%(tempObj.name,controlTypes.speechRoleLabels[tempObj.role],tempObj.windowClassName,tempObj.appModule.appName))
+			except:
+				pass
+			tempObj=getDesktopObject()
 		# Scan backwards through the old ancestors looking for a match.
 		for index in xrange(oldFocusLineLength-1,-1,-1):
 			if tempObj==oldFocusLine[index]:



More information about the Nvda-dev mailing list