Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.windows.x Frequently Asked Questions (FAQ) 7/7
Section - 150) Is this a memory leak in the X11R4 XtDestroyWidget()?!

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Houses ]


Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 149) I'm writing a widget and can't use a float as a resource value.
Next Document: 151) Is this a memory leak in the X11R4 deletion of work procs?!
See reader questions & answers on this topic! - Help others by sharing your knowledge

Yes. This is the "unofficial" fix-19 for the X11R4 Destroy.c:

*** Destroy.c.1.37	Thu Jul 11 15:41:25 1991
--- lib/Xt/Destroy.c	Thu Jul 11 15:42:23 1991
***************
*** 1,4 ****
--- 1,5 ----
  /* $XConsortium: Destroy.c,v 1.37 90/09/28 10:21:32 swick Exp $ */
+ /* Plus unofficial patches in revisions 1.40 and 1.41 */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 221,239 ****
       */
  
      int i = 0;
!     DestroyRec* dr = app->destroy_list;
      while (i < app->destroy_count) {
  	if (dr->dispatch_level >= dispatch_level)  {
  	    Widget w = dr->widget;
  	    if (--app->destroy_count)
  		bcopy( (char*)(dr+1), (char*)dr,
! 		       app->destroy_count*sizeof(DestroyRec)
  		      );
  	    XtPhase2Destroy(w);
  	}
  	else {
  	    i++;
- 	    dr++;
  	}
      }
  }
--- 222,245 ----
       */
  
      int i = 0;
!     DestroyRec* dr;
      while (i < app->destroy_count) {
+ 
+ 	/* XtPhase2Destroy can result in calls to XtDestroyWidget,
+ 	 * and these could cause app->destroy_list to be reallocated.
+ 	 */
+ 
+ 	dr = app->destroy_list + i;
  	if (dr->dispatch_level >= dispatch_level)  {
  	    Widget w = dr->widget;
  	    if (--app->destroy_count)
  		bcopy( (char*)(dr+1), (char*)dr,
! 		       (app->destroy_count - i) * sizeof(DestroyRec)
  		      );
  	    XtPhase2Destroy(w);
  	}
  	else {
  	    i++;
  	}
      }
  }

[from Donna Converse, converse@x.org]

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 149) I'm writing a widget and can't use a float as a resource value.
Next Document: 151) Is this a memory leak in the X11R4 deletion of work procs?!

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
faq%craft@uunet.uu.net (X FAQ maintenance address)





Last Update March 27 2014 @ 02:12 PM