[PATCH resend 1/8] comctl32/listbox: Make SetCount fail if LBS_NODATA is not set

Nikolay Sivov nsivov at codeweavers.com
Mon Nov 5 06:38:17 CST 2018


On 11/05/2018 02:17 PM, Gabriel Ivăncescu wrote:

> Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
> ---
>
> Can anyone please look at this series? Nikolay? They are needed to finally
> implement LBS_NODATA (which I've already written but I'm sure it will need
> some changes, however I need these series first anyway).

What we need first is more tests covering this series and actual 
implementation that you have written.

>
>   dlls/comctl32/listbox.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
> index 2137ef8..0a7c341 100644
> --- a/dlls/comctl32/listbox.c
> +++ b/dlls/comctl32/listbox.c
> @@ -1752,7 +1752,7 @@ static LRESULT LISTBOX_SetCount( LB_DESCR *descr, INT count )
>   {
>       LRESULT ret;
>   
> -    if (HAS_STRINGS(descr))
> +    if (!(descr->style & LBS_NODATA))
>       {
>           SetLastError(ERROR_SETCOUNT_ON_BAD_LB);
>           return LB_ERR;
> @@ -2518,6 +2518,9 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc )
>       if (descr->style & LBS_OWNERDRAWVARIABLE) descr->style |= LBS_NOINTEGRALHEIGHT;
>       descr->item_height = LISTBOX_SetFont( descr, 0 );
>   
> +    if ((descr->style & (LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_SORT)) != LBS_OWNERDRAWFIXED)
> +        descr->style &= ~LBS_NODATA;
> +

It's easier to see and test if it's correct when it fixes existing tests.

P.S. please let's focus on a single module first, user32 or comctl32, 
your choice. This will reduce a number of patches you have to send, and 
we still can duplicate for other module later.

>       if (descr->style & LBS_OWNERDRAWFIXED)
>       {
>   	if( descr->lphc && (descr->lphc->dwStyle & CBS_DROPDOWN))




More information about the wine-devel mailing list