]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/choice.cpp
fixing overrelease and out-of-bounds write, fixes #13725
[wxWidgets.git] / src / msw / choice.cpp
index 1cb3bd93869e414b56f3dc2775c68885e5203fa0..e7c17023c1c48bf52a43ffbc02ca669de32bebd3 100644 (file)
@@ -200,12 +200,12 @@ wxChoice::~wxChoice()
     Clear();
 }
 
-bool wxChoice::MSWGetComboBoxInfo(COMBOBOXINFO* info) const
+bool wxChoice::MSWGetComboBoxInfo(tagCOMBOBOXINFO* info) const
 {
     // TODO-Win9x: Get rid of this once we officially drop support for Win9x
     //             and just call the function directly.
 #if wxUSE_DYNLIB_CLASS
-    typedef BOOL (WINAPI *GetComboBoxInfo_t)(HWND, COMBOBOXINFO*);
+    typedef BOOL (WINAPI *GetComboBoxInfo_t)(HWND, tagCOMBOBOXINFO*);
     static GetComboBoxInfo_t s_pfnGetComboBoxInfo = NULL;
     static bool s_triedToLoad = false;
     if ( !s_triedToLoad )
@@ -631,6 +631,9 @@ wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const
     // and its child part. I.e. arrow, separators, etc.
     wxSize tsize(xlen, 0);
 
+    // FIXME-VC6: Only VC6 needs this guard, see WINVER definition in
+    //            include/wx/msw/wrapwin.h
+#if defined(WINVER) && WINVER >= 0x0500
     WinStruct<COMBOBOXINFO> info;
     if ( MSWGetComboBoxInfo(&info) )
     {
@@ -638,6 +641,7 @@ wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const
                     + info.rcItem.left + 3; // right and extra margins
     }
     else // Just use some rough approximation.
+#endif // WINVER >= 0x0500
     {
         tsize.x += 4*cHeight;
     }