Skip to content

Commit

Permalink
Provide a quick fix to a crash in NVDA due to a bug shared between co…
Browse files Browse the repository at this point in the history
…mtypes VARIANT implementation and ctypes callbacks. Re #3867

Stops crashes in NVDA's log viewer and in windbg, when either contains a large amount of text and then its some how updated.
  • Loading branch information
michaelDCurran committed Feb 10, 2014
1 parent 1ad5982 commit f14f906
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/_UIAHandler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from ctypes import *
from ctypes.wintypes import *
import comtypes.client
from comtypes.automation import VT_EMPTY
from comtypes import *
import weakref
import threading
Expand Down Expand Up @@ -212,6 +213,9 @@ def IUIAutomationFocusChangedEventHandler_HandleFocusChangedEvent(self,sender):
eventHandler.queueEvent("gainFocus",obj)

def IUIAutomationPropertyChangedEventHandler_HandlePropertyChangedEvent(self,sender,propertyId,newValue):
# #3867: For now manually force this VARIANT type to empty to get around a nasty double free in comtypes/ctypes.
# We also don't use the value in this callback.
newValue.vt=VT_EMPTY
if not self.MTAThreadInitEvent.isSet():
# UIAHandler hasn't finished initialising yet, so just ignore this event.
return
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
- Better reporting of JComboBox controls (html no longer reported, better reporting of expanded and collapsed states). (#3755)
- More text is included in automatic dialog caption calculations. (#3757)
- Changes to the name, value or description of the focused control is now reported more accurately. (#3770)
- Fix a crash in NVDA seen in Windows 8 when focusing on certain RichEdit controls containing large amounts of text (e.g. NVDA's log viewer, windbg). (#3867)


== Changes for Developers ==
Expand Down

0 comments on commit f14f906

Please sign in to comment.