]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't use dangling pointers in wxWindowMSW::HandleMenuChar().
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 12 Jul 2010 22:50:28 +0000 (22:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 12 Jul 2010 22:50:28 +0000 (22:50 +0000)
We used a pointer into the result of wx_str() for a temporary string which was
clearly wrong. Store the string we're manipulating to ensure that this doesn't
happen.

This in particular fixes keyboard navigation in the menus with owner-drawn
items.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index 9a6b7259a62c3e2b3199ff1abb92ffbf106a120c..3d117a69693e381637522ce2b052b2b36e900b92 100644 (file)
@@ -5724,7 +5724,8 @@ int wxWindowMSW::HandleMenuChar(int WXUNUSED_IN_WINCE(chAccel),
                 //  menu creation code
                 wxMenuItem *item = (wxMenuItem*)mii.dwItemData;
 
-                const wxChar *p = wxStrchr(item->GetItemLabel().wx_str(), wxT('&'));
+                const wxString label(item->GetItemLabel());
+                const wxChar *p = wxStrchr(label.wx_str(), wxT('&'));
                 while ( p++ )
                 {
                     if ( *p == wxT('&') )