From 94a873707cf5f7f9db8a1106a41cb06fffd76965 Mon Sep 17 00:00:00 2001 From: id Date: Sat, 1 May 1999 20:59:07 +0000 Subject: [PATCH] Fix a crash in user menu and a menu map bug. --- src/actions.c | 3 ++- src/usermenu.c | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/actions.c b/src/actions.c index f8cfb643..944f43ad 100644 --- a/src/actions.c +++ b/src/actions.c @@ -235,7 +235,8 @@ wSetFocusTo(WScreen *scr, WWindow *wwin) wUserMenuRefreshInstances(napp->menu, wwin); #endif /* USER_MENU */ - wAppMenuMap(napp->menu, wwin); + if (wwin->flags.mapped) + wAppMenuMap(napp->menu, wwin); #ifdef NEWAPPICON wApplicationActivate(napp); #endif diff --git a/src/usermenu.c b/src/usermenu.c index cb5bf483..a4abedd1 100644 --- a/src/usermenu.c +++ b/src/usermenu.c @@ -331,19 +331,20 @@ wUserMenuGet(WScreen *scr, WWindow *wwin) char buffer[100]; char *path = NULL; char *tmp; + if ( wwin->wm_instance && wwin->wm_class ) { + tmp=wmalloc(strlen(wwin->wm_instance)+strlen(wwin->wm_class)+7); + sprintf(tmp,"%s.%s.menu",wwin->wm_instance,wwin->wm_class); + path = wfindfile(DEF_USER_MENU_PATHS,tmp); + free(tmp); + + if (!path) return NULL; + + if (wwin) { + menu = readUserMenuFile(scr, path); + } - tmp=wmalloc(strlen(wwin->wm_instance)+strlen(wwin->wm_class)+7); - sprintf(tmp,"%s.%s.menu",wwin->wm_instance,wwin->wm_class); - path = wfindfile(DEF_USER_MENU_PATHS,tmp); - free(tmp); - - if (!path) return NULL; - - if (wwin) { - menu = readUserMenuFile(scr, path); + free(path); } - - free(path); return menu; } -- 2.11.4.GIT