Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: zjmw36@trc.amoco.COM (Joe M. Wade) Newsgroups: comp.windows.x Subject: bug in R4 Intrinsics Message-ID: <9105021950.AA15411@gpsd.trc.amoco.com> Date: 2 May 91 19:50:48 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 51 I have found what I believe to be a bug in the R4 intrinsics. The code which I believe is suspect is in the subroutine _XtDoPhase2Destroy in the Destroy.c source. When destroying a widget from within this routine, it is being removed from the app->destroy_list and the list is shifted down. However, the byte count on the list shift appears to be in error. It is currently shifting app->destroy_count items down starting at the location following the one being removed. In the case of my program, that caused the shifting of my widget's structure. I believe the actual number of items copied should be app->destroy_count-i, where i is the location of the one being removed. This is after app->destroy_count has been decremented. Here's the subroutine: void _XtDoPhase2Destroy(app, dispatch_level) XtAppContext app; int dispatch_level; { /* Phase 2 must occur in fifo order. List is not necessarily * contiguous in dispatch_level. */ 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, /* -- here's what I believe is a bug app->destroy_count*sizeof(DestroyRec) */ (app->destroy_count-i)*sizeof(DestroyRec) ); XtPhase2Destroy(w); } else { i++; dr++; } } } Making the change did cause my code to go ahead and work ( as if that's any kind of proof :-> ) Could you please let me know if this is, in fact, a bug? (if so, has it already been covered by a patch ? ) Thx. Joe