From 87ebe668804b2e480c691b16e699ebc242ff3f3a Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 16 Aug 2015 22:51:32 +0100 Subject: [PATCH] Check menuobj before we dispose it --- amiga/menu.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/amiga/menu.c b/amiga/menu.c index 556b01496..21c12b925 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -517,19 +517,15 @@ void ami_free_menulabs(struct gui_window_2 *gwin) { int i; - for(i=0;i<=AMI_MENU_AREXX_MAX;i++) - { - if(gwin->menulab[i] && (gwin->menulab[i] != NM_BARLABEL)) - { - if(gwin->menutype[i] & MENU_IMAGE) - { - DisposeObject(gwin->menuobj[i]); + for(i=0;i<=AMI_MENU_AREXX_MAX;i++) { + if(gwin->menulab[i] && (gwin->menulab[i] != NM_BARLABEL)) { + if(gwin->menutype[i] & MENU_IMAGE) { + if(gwin->menuobj[i]) DisposeObject(gwin->menuobj[i]); } ami_utf8_free(gwin->menulab[i]); - if(i >= AMI_MENU_AREXX) - { + if(i >= AMI_MENU_AREXX) { if(gwin->menu_hook[i].h_Data) free(gwin->menu_hook[i].h_Data); } } @@ -888,7 +884,7 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin) if(gwin->menukey[i]) gwin->menu[i].nm_CommKey = &gwin->menukey[i]; gwin->menu[i].nm_Flags = 0; if(gwin->menu_hook[i].h_Entry) gwin->menu[i].nm_UserData = &gwin->menu_hook[i]; - + if(gwin->menuicon[i]) { free(gwin->menuicon[i]); gwin->menuicon[i] = NULL;