Thomas Weidenmueller : comctl32: Fix handling of CB_RESETCONTENT in ComboBoxEx.

Alexandre Julliard julliard at winehq.org
Mon Nov 19 08:19:38 CST 2007


Module: wine
Branch: master
Commit: 05a9678d20c86c50035e7f5ca3faf5bc011ed0ee
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=05a9678d20c86c50035e7f5ca3faf5bc011ed0ee

Author: Thomas Weidenmueller <thomas at reactsoft.com>
Date:   Fri Nov 16 13:49:38 2007 -0700

comctl32: Fix handling of CB_RESETCONTENT in ComboBoxEx.

---

 dlls/comctl32/comboex.c |   39 ++++++++++++++++++++++++++-------------
 1 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index 299a997..006b8a6 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -1578,6 +1578,27 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di
 }
 
 
+static void COMBOEX_ResetContent (COMBOEX_INFO *infoPtr)
+{
+    if (infoPtr->items)
+    {
+        CBE_ITEMDATA *item, *next;
+
+        item = infoPtr->items;
+        while (item) {
+            next = item->next;
+            COMBOEX_FreeText (item);
+            Free (item);
+            item = next;
+        }
+        infoPtr->items = 0;
+    }
+
+    infoPtr->selected = -1;
+    infoPtr->nb_items = 0;
+}
+
+
 static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr)
 {
     if (infoPtr->hwndCombo)
@@ -1586,18 +1607,7 @@ static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr)
     Free (infoPtr->edit);
     infoPtr->edit = 0;
 
-    if (infoPtr->items) {
-        CBE_ITEMDATA *item, *next;
-
-	item = infoPtr->items;
-	while (item) {
-	    next = item->next;
-	    COMBOEX_FreeText (item);
-	    Free (item);
-	    item = next;
-	}
-	infoPtr->items = 0;
-    }
+    COMBOEX_ResetContent (infoPtr);
 
     if (infoPtr->defaultFont)
 	DeleteObject (infoPtr->defaultFont);
@@ -2234,12 +2244,15 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	case CB_GETLBTEXTLEN:
             return COMBOEX_GetListboxText(infoPtr, wParam, NULL);
 
+	case CB_RESETCONTENT:
+            COMBOEX_ResetContent(infoPtr);
+            /* fall through */
+
 /*   Combo messages we are not sure if we need to process or just forward */
 	case CB_GETDROPPEDCONTROLRECT:
 	case CB_GETITEMHEIGHT:
 	case CB_GETEXTENDEDUI:
 	case CB_LIMITTEXT:
-	case CB_RESETCONTENT:
 	case CB_SELECTSTRING:
 
 /*   Combo messages OK to just forward to the regular COMBO */




More information about the wine-cvs mailing list