Ticket #13053 (confirmed defect)
Application hung (infinite loop) if the same class-name is used twice for different classes with event tables
|Reported by:||gal_wxwidgets||Owned by:|
See also #13051 - for older 2.8.x branch
Notes and references
The bug + patch is also available with Ubuntu bug https://launchpad.net/bugs/735462
What you expected to happen
The wxwidgets should check for duplicate insertion into the event table and flag a duplicate insert of the same class as an error
What happened instead
The second insert (of the same table) did succeed and create a cycle within the linked list.
On initialization, the initialization of the linked list entered an infinite loop
Description of patch
Add a check for the error case of "duplicate insert into the linked-list of the event tables"
If a duplicate insert is detected, then issue an error and avoid the re-insert. It is then, the responsibility of the developer of the program, to fix the error within his code and to avoid using the same class name twice.
Reproducing the error case that this patch detect
- Create a class (within your program) that has the same class-name as a class that already exist within the wxwidgets code. Both classes should have event tables.
- Compile this code into your executable
- Link with a shared version of the wxwidgets libraries
- Start the application:
- The executable is initiated (before calling main()) - and the event table is added to the link list for the first time
- The shared libraries of the wxwidgets are initiated
- The event table from the wxwidgets shared library is resolved to the symbol from the executable (with the same name) and NOT to the symbol within the shared library
- The SAME event table is added for the SECOND time into the linked list and create a cycle
- main() is called
- wxwidget is initialize - and it get stack with an infinite loop when trying to initiate the linked list of the event table
Creating the patch
- Get sources
svn checkout svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets
- Apply the patch at http://trac.wxwidgets.org/browser/wxWidgets/trunk/src/common/event.cpp#L863
- get diff
svn diff wxWidgets > check-for-cycle-dependency.patch