From 92d4d5fb5dd5a8a7babfbd3398b8886e54c0cc83 Mon Sep 17 00:00:00 2001 From: Eddy De Greef Date: Wed, 9 Jun 2004 17:52:58 +0000 Subject: [PATCH] Crash fix: bgMenuUndo/RedoItem were memcopied when opening multiple tabs in a window. This could eventually result in accesses to destroyed bg menu items (and crashes), but only when the tabs use different language modes. That's why crashes were rather rare (and the illegal accesses didn't always result in a crash). --- source/userCmds.c | 10 ++++++---- source/window.c | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/userCmds.c b/source/userCmds.c index 98d3cc0..439cc55 100644 --- a/source/userCmds.c +++ b/source/userCmds.c @@ -1,4 +1,4 @@ -static const char CVSID[] = "$Id: userCmds.c,v 1.45 2004/03/29 14:42:49 tksoh Exp $"; +static const char CVSID[] = "$Id: userCmds.c,v 1.46 2004/06/09 17:52:58 edg Exp $"; /******************************************************************************* * * * userCmds.c -- Nirvana Editor shell and macro command dialogs * @@ -1384,9 +1384,11 @@ static void updateMenu(WindowInfo *window, int menuType) /* manage user menu items depending on current language mode */ manageUserMenu(&menu, window); - /* Set the proper sensitivity of items which may be dimmed */ - SetBGMenuUndoSensitivity(window, XtIsSensitive(window->undoItem)); - SetBGMenuRedoSensitivity(window, XtIsSensitive(window->redoItem)); + if (menuType == BG_MENU_CMDS) { + /* Set the proper sensitivity of items which may be dimmed */ + SetBGMenuUndoSensitivity(window, XtIsSensitive(window->undoItem)); + SetBGMenuRedoSensitivity(window, XtIsSensitive(window->redoItem)); + } DimSelectionDepUserMenuItems(window, window->buffer->primary.selected); } diff --git a/source/window.c b/source/window.c index 967d0ba..5ecfe46 100644 --- a/source/window.c +++ b/source/window.c @@ -1,4 +1,4 @@ -static const char CVSID[] = "$Id: window.c,v 1.157 2004/05/16 12:02:34 tksoh Exp $"; +static const char CVSID[] = "$Id: window.c,v 1.158 2004/06/09 17:52:58 edg Exp $"; /******************************************************************************* * * * window.c -- Nirvana Editor window creation/deletion * @@ -3397,6 +3397,8 @@ WindowInfo *CreateDocument(WindowInfo *shellWindow, const char *name, window->findLastRegexCase = TRUE; window->findLastLiteralCase = FALSE; window->tab = NULL; + window->bgMenuUndoItem = NULL; + window->bgMenuRedoItem = NULL; if (window->fontList == NULL) XtVaGetValues(shellWindow->statsLine, XmNfontList, -- 2.11.4.GIT