Quantcast

FW: [wxPython-dev] wxPython 4/wx.Yield: C++ assert failure

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

FW: [wxPython-dev] wxPython 4/wx.Yield: C++ assert failure

Joseph Lee

Hi Jamie,

Hope this helps.

Cheers,

Joseph

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Kevin Ollivier
Sent: Thursday, April 27, 2017 11:31 AM
To: [hidden email]
Subject: Re: [wxPython-dev] wxPython 4/wx.Yield: C++ assert failure

 

Hi Joseph,

 

The NVDA developer is likely correct, but your example shows expected behavior, not a bug. You're adding an infinite number of timer events, then calling wx.Yield in them. This will cause infinite recursion, as wx.Yield will process the next timer event, which will call wx.Yield, which will process the next timer event, which will call wx.Yield, and so on. I don't think a change in wx.Yield is at fault here, it's just alerting you to the recursion instead of causing it. To get to the bottom of this, you'll need to find out what is triggering the recursion in NVDA.

 

Taking a quick look at the NVDA code's use of wx.Yield, I think the first step would probably be to find out if api.py's processPendingEvents is somehow calling itself multiple times. If you can identify the specific set of steps that trigger recursion, the NVDA developers will probably be able to come up with some ideas for workarounds or fixes.

 

Regards,

 

Kevin

 

From: <[hidden email]> on behalf of Joseph Lee <[hidden email]>
Reply-To: <[hidden email]>
Date: Thursday, April 27, 2017 at 9:36 AM
To: <[hidden email]>
Subject: RE: [wxPython-dev] wxPython 4/wx.Yield: C++ assert failure

 

Hi Robin,

At least wx.YieldIfNeeded suppresses the assertions. However, according to a lead NVDA developer, this does not really resolve this problem, as NVDA needs to handle other events external to wxWidgets such as accessibility events. The lead developer (not me) believes that the root problem might have to do with timers and certain things that are internally different between wxPython classic and phoenix.

Can you try out this example and see if we can trace this:

https://www.dropbox.com/s/p8uuf52hzlmyd3x/wxReentrance.py?dl=1

 

Note that the example requires Python 2.7 with wxPython 4.0.0A1. Thanks.

Cheers,

Joseph

 

From: [hidden email] [[hidden email]] On Behalf Of Robin Dunn
Sent: Thursday, April 27, 2017 12:17 AM
To: [hidden email]
Subject: Re: [wxPython-dev] wxPython 4/wx.Yield: C++ assert failure

 

Joseph Lee wrote:

Hi Robin and others,

 

In one of the projects I’m involved in (NonVisual Desktop Access), numerous calls to wx.Yield function are made from various modules. After porting NVDA to wxPython 4 alpha, when wx.Yield is called from some modules, I get a traceback that ends with the following:

wxAssertionError: C++ assertion "Assert failure" failed at ..\..\src\common\evtloopcmn.cpp(110) in wxEventLoopBase::Yield(): wxYield called recursively

 

Relevant GitHub issue for NVDA can be found at:

https://github.com/nvaccess/nvda/issues/7077

 

The source code for a version of NVDA that uses wxPython 4 can be found at:

https://github.com/josephsl/nvda

 

Branch is “wxPy4”. I and other NVDA developers involved in porting NVDA to wxPython 4 consider this a showstopper, with a lead developer commenting that this might be due to reentrancy issue.


Yes. Basically some event(s) happens while within a wx.Yield call which then results in some other code being called that uses wx.Yield.

The best fix would be to find ways to avoid needing to use yield. Otherwise you could switch to wx.YieldIfNeeded() (which is just a convenience wrapper for wx.GetApp().Yield(True)...) That will just return when the recursion is detected instead of asserting about it.  The wx.EventLoopBase.Yield documentation is applicable to this as all the incarnations of Yield eventually get to that method.

--
Robin Dunn
Software Craftsman
http://wxPython.org

--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Loading...