[ wxwindows-Patches-1693063 ] Fix access of previously freed memory

SourceForge.net noreply at sourceforge.net
Mon Apr 2 08:55:57 PDT 2007


Patches item #1693063, was opened at 2007-04-02 17:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1693063&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: bug fix
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Tim Kosse (botg)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix access of previously freed memory

Initial Comment:
I've found this while running my programs through valgrind.

In src/gtk/window.cpp in the function gtk_window_focus_out_callback, win->m_wxwin gets accessed after generating an the event. However, the event might delete win, resulting in an access to previously freed memory.

This happens for example if calling wxListCtrl::EditLabel and then clicking any other control in the program. The edit control deletes itself if it looses focus.

The attached patch remembers the value of win->m_wxwin prior to sending the event.


I think this problem also exists on wxMAC. The patch also contains a fix for this. However I could not test the fix under OS X due to lack of said system.


Patch is against 2.8 branch, but should apply against HEAD as well (maybe some offset).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1693063&group_id=9863




More information about the wx-dev mailing list