]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
fixed typo in library name
[wxWidgets.git] / src / msw / listctrl.cpp
index 4b6191aa84c2dd57bc960fe0fdc6dd262a066be8..943a87ae8da8bd59c2a6cbde8d6b2aa0e798236a 100644 (file)
@@ -119,12 +119,7 @@ private:
 #if wxUSE_WCHAR_T
         if ( (item.mask & LVIF_TEXT) && item.pszText )
         {
-#ifdef __WXWINE__
-            // FIXME
-            m_buf = new wxWC2WXbuf(wxConvLocal.cWC2WX((const __wchar_t* ) item.pszText));
-#else
             m_buf = new wxWC2WXbuf(wxConvLocal.cWC2WX(item.pszText));
-#endif
             m_item->pszText = (wxChar*)m_buf->data();
         }
         else
@@ -137,6 +132,8 @@ private:
 #endif // wxUSE_UNICODE/!wxUSE_UNICODE
 
     LV_ITEM *m_item;
+
+    DECLARE_NO_COPY_CLASS(wxLV_ITEM)
 };
 
 ///////////////////////////////////////////////////////
@@ -183,6 +180,8 @@ public:
        if (attr)
            delete attr;
    };
+
+    DECLARE_NO_COPY_CLASS(wxListItemInternalData)
 };
 
 // Get the internal data structure
@@ -1753,7 +1752,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                     // there's a GPF in Windows.
                     // By returning TRUE here, we avoid further processing
                     // of this strange message.
-                    if (info->iItem > GetColumnCount())
+                    if ( info->iItem >= GetColumnCount() )
                         return TRUE;
                 }
                 // fall through
@@ -1782,6 +1781,30 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
             case LVN_ITEMCHANGING:
                 if ( iItem != -1 )
                 {
+                    if ( iItem >= GetItemCount() )
+                    {
+                        // there is apparently a bug in comctl32.dll version
+                        // 5.50.4704.1100 (note that the MS DLL database
+                        // doesn't say what this version is, it's not the one
+                        // shipped with W2K although the bug was reported under
+                        // that system) and it sends us LVN_ITEMCHANGING
+                        // notifications with the item out of range -- and as
+                        // we access the items client data, we crash below
+                        //
+                        // see
+                        //
+                        //  http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:29852:knlihdmadhaljafjajei
+                        //
+                        // and the thread continuation for more details
+                        // (although note that the bug may be present in other
+                        // versions of comctl32.dll as well as it has been
+                        // reported quite a few times)
+                        //
+                        // to fix this, simply ignore these "bad" events (as
+                        // above with HDN_GETDISPINFOW)
+                        return TRUE;
+                    }
+
                     wxListItemInternalData *internaldata =
                         (wxListItemInternalData *) nmLV->lParam;