Bugzilla – Bug 494586
Selecting the child of a menu can cause the application to crash
Last modified: 2009-06-08 03:44:44 UTC
PROBLEM STATEMENT Selecting a menu child of a menu parent causes crash if the menu parent's menu bar parent (i.e., the menu child's grandparent) is not selected first. To illustrate, consider the menustrip.py sample application: The menustrip.py sample application has a menu bar (or MenuStrip) that has a 'File' menu. The 'File' menu has several children, the first of which is another menu labeled 'New'. The application will crash if the 'New' menu is selected by calling pyatspi's querySelection().selectChild(0) from the 'File' menu accessible, unless the querySelection().selectChild(0) was previous called from the menu bar accessible. REPRO 1. Run uia2atk/test/samples/menustrip.py 2. Run the attached script, which does the following: a. Finds the "File" menu accessible b. Attempts to select it's 1st child, which is the "New" menu. RESULTS The application crashes, and prints the following trace: Traceback (most recent call last): File UIAutomationWinforms, line unknown, in PerformClick File System.Windows.Forms, line unknown, in ShowDropDown File System.Windows.Forms, line unknown, in get_DropDownLocation File menustrip, line unknown, in Initialize File System.Windows.Forms, line unknown, in Run File System.Windows.Forms, line unknown, in Run File System.Windows.Forms, line unknown, in RunLoop File System.Windows.Forms, line unknown, in GetMessage File System.Windows.Forms, line unknown, in GetMessage File System.Windows.Forms, line unknown, in ExecuteClientMessage File mscorlib, line unknown, in Run File mscorlib, line unknown, in Run File System.Windows.Forms, line unknown, in ExecutionCallback File mscorlib, line unknown, in DynamicInvoke File mscorlib, line unknown, in DynamicInvokeImpl File mscorlib, line unknown, in DynamicInvokeImpl StandardError: Exception has been thrown by the target of an invocation. Segmentation fault EXPECTED RESULTS Application should not crash. It looks like Gtk doesn't display anything when something similar is attempted there. But it doesn't seem like querySelection().selectChild(n) works that well for Gtk's MenuBar either. So I am not entirely sure what we should do here... but we definitely shouldn't crash :) COMMENTS You can uncomment lines 18-20 in the attached script and then run it to see that the application doesn't crash if the 'File' menu is selected before trying to select the 'File' menu's child. Another thing that may be worth mentioning: Pressing 'Escape' immediately after opening the 'File' menu dismisses the 'File' menu, but selecting the 'File' menu's child afterwards doesn't not crash the application. Lines 22-27 in the attached script can be uncommented to illustrate this behavior. These lines must be uncommented in addition to lines 18-20.
Created attachment 285491 [details] Script referenced in REPRO steps
Fix pending review: http://reviews.mono-a11y.org/r/168/
Fixed in UIAutomationWinforms (trunk r133036, 1.0 r133037).
when run the attached script, the application won't crash. verify in: mono-core-135601-1177.src.rpm mono-uia-132785-276.src.rpm uiaatkbridge-134036-662.src.rpm uiautomationwinforms-134512-668.src.rpm Revision: 135624