Ticket #14727 (closed defect: fixed)
Application using wxListCtrl is getting a "wxYield() called recursively" error
| Reported by: | jdagresta | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.9.5 |
| Component: | wxGTK | Version: | 2.9.4 |
| Keywords: | wxListCtrl wxYield Linux | Cc: | jdagresta@… |
| Blocked By: | Patch: | yes | |
| Blocking: |
Description
Our application is like Windows Explorer in that it has a wxTreeCtrl side-by-side with a wxListCtrl.
One of our customers, on the Linux platform, has the problem that sometimes when they select an item in the Tree control (which initiates and update of the List control) they get a pop-up error window with a "wxYield() called recursively" message.
We have been unable to reproduce the problem in-house, but the customer can easily reproduce the problem (and have sent us screen snaps of the error pop-up).
I see in the wxWidgets code the warnings about using wxYield() and the potential for this kind of problem and the alternate "safer" routines that have been provided.
I see that all of the calls to wxYield() in the Tree control code have been replaced by wxYieldIfNeeded() calls.
Then I noticed that src/generic/listctrl.cpp contains a call to wxSafeYield(), but without specifying 'true' for the onlyIfNeeded argument (which defaults to 'false').
I tried a test where I changed the wxSafeYield() to wxSafeYield(NULL, true), which is the equivalent of changing wxYield() to wxYieldIfNeeded(), and sent our application with that change to the customer and they've verified that it fixes the wxYield() called recursively problem.
I propose that this change be made to the wxWidgets code; proposed patch is attached.

