Repository: nvaccess/nvda

Issue:
Mail app in windows 10 causes NVDA to fall silent

### Steps to reproduce:
Open the windows 10 Mail app
open a email with links within
click on any link, it doesnt seem to matter which site, and  open dfault browsr, in my case this is firefox 65
after you finished on the web page close firefox,  
go back to window mail app
then more often than not NVDA fall silent
in which case NVDA has to be restarted to regain speech once again


### Actual behavior:

### Expected behavior:

after closing the browser NVDA should still have the use of its speech

### System configuration
n/a

#### NVDA installed/portable/running from source:
Installed copy of NVDA 

#### NVDA version:
version 18.4.1


#### Windows version:
windows 10 1809 17763.348

#### Name and version of other software in use when reproducing the issue:
latest version of the mail app will do


#### Other information about your system:
n/a

### Other questions
#### Does the issue still occur after restarting your PC?
No, even a restart of NVDA will resolve the issue usually

##
## Have you tried any other versions of NVDA?
Yes, same issue





Discussion:
Do you have this issue after installing the Windows 10 app essentials addon from @josephsl?
yes, i have the win10 app essentials addon installed
whether that is causing the issue or not i could not tell you for sure

Hi,

If you don't mind, can we get a debug log from you please?

Thanks.
[1-NVDA log.txt](https://github.com/nvaccess/nvda/files/2946334/1-NVDA.log.txt)



Hi, looks like the app module/tree interceptor isn’t cleaned up properly, raising COM error exception. I’ll do something about it from WinTenApps side later today. CC @MichaelDCurran

 

From: ChrisMedley <notifications@github.com> 
Sent: Friday, March 8, 2019 7:21 AM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Joseph Lee <joseph.lee22590@gmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [nvaccess/nvda] Mail app in windows 10 causes NVDA to fall silent (#9341)

 

1-NVDA log.txt <https://github.com/nvaccess/nvda/files/2946334/1-NVDA.log.txt> 

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <https://github.com/nvaccess/nvda/issues/9341#issuecomment-470964575> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHgLkBIHbMnsv9CRsy-45d-4BYjWkcZGks5vUn_HgaJpZM4bbJhn> .



Resolving patch:
diff --git a/source/appModules/hxmail.py b/source/appModules/hxmail.py
--- a/source/appModules/hxmail.py
+++ b/source/appModules/hxmail.py
@@ -1,11 +1,12 @@
 #A part of NonVisual Desktop Access (NVDA)
-#Copyright (C) 2016 NV Access Limited
+#Copyright (C) 2016-2019 NV Access Limited, Joseph Lee
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
 
 """An appModule for the Windows 10 Mail app"""
 
 import appModuleHandler
+from comtypes import COMError
 import UIAHandler
 from NVDAObjects.UIA.wordDocument import WordDocument
 
@@ -21,7 +22,11 @@ def _get_shouldCreateTreeInterceptor(self):
 		# Locate the Reading pane in the ancestors
 		condition=UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_ClassNamePropertyId,"ReadingPaneModern")
 		walker=UIAHandler.handler.clientObject.createTreeWalker(condition)
-		parent=walker.NormalizeElement(self.UIAElement)
+		# #9341: when Mail app exits, tree interceptor isn't cleaned up properly ,raising COM error exception and causing NVDA to go silent.
+		try:
+			parent=walker.NormalizeElement(self.UIAElement)
+		except COMError:
+			parent=None
 		if not parent:
 			return False
 		# If we can find the message headers, then it is read-only and therefore needs browseMode


Test patch: