Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!purdue!decwrl!hplabs!hp-pcd!hpcvlx!fred From: fred@hpcvlx.HP.COM (Fred Taft) Newsgroups: comp.windows.x Subject: Re: HP's Xtk Fixes (as Context Diffs) Message-ID: <1610045@hpcvlx.HP.COM> Date: 19 Aug 88 19:51:40 GMT References: <1610043@hpcvlx.HP.COM> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 39 VERSION: Xtk release 2 SYNOPSIS: CoreDestroy() should free up the memory occupied by the widget's destroy callback list. DESCRIPTION: The CoreDestroy() routine fails to free up the memory occupied by a widget's destroy callback list, thus cause a memory leak. REPEAT BY: Write a program which creates a bunch of widgets, and then adds destroy callbacks to each widget; then destroy the widgets. (Have the program repeat this several times). FIX: *** Core.c Fri Aug 19 11:26:00 1988 --- Core.new.c Fri Aug 19 11:25:42 1988 *************** *** 289,294 if (win) XDestroyWindow(XtDisplay(widget), win); } if (widget->core.popup_list != NULL) XtFree(widget->core.popup_list); XtFree((char *) widget); } /* CoreDestroy */ --- 297,306 ----- if (win) XDestroyWindow(XtDisplay(widget), win); } if (widget->core.popup_list != NULL) XtFree(widget->core.popup_list); + + /* Remove the destroy_callbacks list */ + XtRemoveAllCallbacks(widget, XtNdestroyCallback); + XtFree((char *) widget); } /* CoreDestroy */