Subject: bug#7190: Crash in menus on w32

From: Jason Rumney <[email-masked]>
Date: Thu, 21 Oct 2010 23:27:10 +0800

grischka <[email-masked]> writes:

>      case WM_EXITMENULOOP:
>        f = x_window_to_frame (dpyinfo, hwnd);
>  
> -      /* If a menu is still active, check again after a short delay,
> -	 since Windows often (always?) sends the WM_EXITMENULOOP
> -	 before the corresponding WM_COMMAND message.
> -         Don't do this if a popup menu is active, since it is only
> -         menubar menus that require cleaning up in this way.
> -      */
>        if (f && menubar_in_use && current_popup_menu == NULL)
> -	menu_free_timer = SetTimer (hwnd, MENU_FREE_ID, MENU_FREE_DELAY, NULL);
> +       {
> +         f->output_data.w32->menubar_active = 0;
> +         menubar_in_use = 0;
> +       }

I don't see anything in your change to handle freeing of the menubar
structures in the case where the user clicks on the menubar then clicks
away without selecting anything.  The above code was to fix a memory and
resource leak in that case.

Jason