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: <1610051@hpcvlx.HP.COM> Date: 19 Aug 88 19:53:03 GMT References: <1610043@hpcvlx.HP.COM> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 64 ### bug number: 420 ### area: Xt ### severity: medium ### comments: workaround: don't reuse these resources VERSION: Xtk release 2 SYNOPSIS: CoreDestroy() frees up resources owned by the application DESCRIPTION: When a widget is destroyed, the CoreDestroy() routine frees up the background pixmap and the border pixmap, if they are defined. Unfortunately, these resource were owned by the application; the intrinsics had not ever made their own private copy. The next time the application tries to use that pixmap, an X Error occurs. REPEAT-BY: Create a widget and assign a background pixmap. Destroy the widget. Create a second widget using the same background pixmap. An X Error occurs. FIX: *** Core.c Fri Aug 19 12:25:31 1988 --- Core.new.c Fri Aug 19 12:25:26 1988 *************** *** 261,266 if (*widget->core.name != '\0') /* special case; we didn't copy this */ XtFree((char *) (widget->core.name)); if (widget->core.background_pixmap > UnspecifiedPixmap) XFreePixmap(XtDisplay(widget), widget->core.background_pixmap); if (widget->core.border_pixmap > UnspecifiedPixmap) --- 261,268 ----- if (*widget->core.name != '\0') /* special case; we didn't copy this */ XtFree((char *) (widget->core.name)); + /* + DON'T FREE UP RESOURCES WE DID NOT ALLOCATE!!!! if (widget->core.background_pixmap > UnspecifiedPixmap) XFreePixmap(XtDisplay(widget), widget->core.background_pixmap); if (widget->core.border_pixmap > UnspecifiedPixmap) *************** *** 265,270 XFreePixmap(XtDisplay(widget), widget->core.background_pixmap); if (widget->core.border_pixmap > UnspecifiedPixmap) XFreePixmap(XtDisplay(widget), widget->core.border_pixmap); event = widget->core.event_table; while (event != NULL) { next = event->next; --- 267,273 ----- XFreePixmap(XtDisplay(widget), widget->core.background_pixmap); if (widget->core.border_pixmap > UnspecifiedPixmap) XFreePixmap(XtDisplay(widget), widget->core.border_pixmap); + */ event = widget->core.event_table; while (event != NULL) { next = event->next;