Commit 06b99c62 authored by Rein Klazes's avatar Rein Klazes Committed by Alexandre Julliard

user32: Fix a bug in computing the maximum depth of a branch in a menu hierarchy.

It was computing the number of submenus in the branch, rather then the maximum depth.
parent 32e35394
......@@ -4646,18 +4646,22 @@ static int MENU_depth( POPUPMENU *pmenu, int depth)
{
int i;
MENUITEM *item;
int subdepth;
depth++;
if( depth > MAXMENUDEPTH) return depth;
item = pmenu->items;
for( i = 0; i < pmenu->nItems && depth <= MAXMENUDEPTH; i++, item++){
POPUPMENU *psubmenu = MENU_GetMenu( item->hSubMenu);
subdepth = depth;
for( i = 0; i < pmenu->nItems && subdepth <= MAXMENUDEPTH; i++, item++){
POPUPMENU *psubmenu = item->hSubMenu ? MENU_GetMenu( item->hSubMenu) : NULL;
if( psubmenu){
int bdepth = MENU_depth( psubmenu, depth);
if( bdepth > depth) depth = bdepth;
if( bdepth > subdepth) subdepth = bdepth;
}
if( subdepth > MAXMENUDEPTH)
TRACE("<- hmenu %p\n", item->hSubMenu);
}
return depth;
return subdepth;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment