pms@arbortext.COM (Pat Sherry) (06/03/91)
I have a large application which get an intermittent BadAtom protocol error in XGetWindowProperty(). This started happening when I relinked my program with patch level 18 of the X libraries. It did not happen with patch level 14 of the intrinsics. I may have some kind of race condition in my code but I think the protocol error is due to a bug in Xt/Selection.c since ReqCleanup() calls IsINCRtype() with a property of 0 (None was returned by the SelectionNotify event). The relevant code from ReqCleanup() in Selection.c starting at line 851 (patch 18 version) is if (ev->type == SelectionNotify) { XSelectionEvent *event = (XSelectionEvent *) ev; if (!MATCH_SELECT(event, info)) return; /* not really for us */ XtRemoveEventHandler(widget, (EventMask)0, TRUE, ReqCleanup, (XtPointer) info ); if (IsINCRtype(info, XtWindow(widget), event->property) #ifndef NO_DRAFT_ICCCM_COMPATIBILITY || event->target == info->ctx->prop_list->incremental_atom #endif ) { info->proc = HandleGetIncrement; XtAddEventHandler(info->widget, (EventMask) PropertyChangeMask, FALSE, ReqCleanup, (XtPointer) info); } else { if (event->property != None) XDeleteProperty(event->display, XtWindow(widget), event->property); It seems to me that ReqCleanup should not call IsINCRtype if event->property == None. Usually when this code is executed by my application, the property corresponds to _XT_SELECTION_0 but in the dbx output below it is 0. Has anyone seen this before? Is is an intrinsics bug? Here is a dbx log leading up to the protocol error. I set a breakpoint in IsINCRtype. In this case, the target window has no properties defined. dbx log: stopped in IsINCRtype at line 832 in file "ironwood/X11/X11R4/src/mit/lib/Xt/Sel ection.c" 832 &type, &format, &length, &bytesafter, &valu e); (dbx) p prop `Selection`IsINCRtype`prop = 0 (dbx) where IsINCRtype(info = 0x380d38, window = 10485821, prop = 0), line 832 in "ironwood/ X11/X11R4/src/mit/lib/Xt/Selection.c" ReqCleanup(widget = 0x3245c0, closure = 0x380d38 "", ev = 0xf7fff740, cont = 0xf 7fff297 "^A"), line 860 in "ironwood/X11/X11R4/src/mit/lib/Xt/Selection.c" DispatchEvent() at 0x26794c DecideToDispatch() at 0x267f7c XtDispatchEvent() at 0x268110 XtAppMainLoop() at 0x268420 main_loop() at 0x1084f8 main() at 0xef30 (dbx) sh xprop -id 10485821 (dbx) up Current function is ReqCleanup 860 ) { (dbx) p *(XSelectionEvent *)event *(XSelectionEvent *) `Selection`ReqCleanup`event = { type = 31 serial = 2306 send_event = 0 display = 0x312528 requestor = 10485821 selection = 1 target = 31 property = 0 time = 1304501801 } (dbx) sh xlsatoms -range 1-1 1 PRIMARY (dbx) sh xlsatoms -range 31-31 31 STRING (dbx) p *info *`Selection`ReqCleanup`info = { callback = &sel_receive_proc() at 0x112d38 req_closure = 0x380fc0 property = 168 target = 0x380fd0 type = 0 format = 0 value = (nil) bytelength = 0 offset = 0 timeout = 3674152 proc = &HandleSelectionReplies() at 0x120840 widget = 0x3245c0 time = 1304501801 ctx = 0x380f08 incremental = '\0' } (dbx) p *info->target *`Selection`ReqCleanup`info->target = 31 (dbx) p *info->ctx *`Selection`ReqCleanup`info->ctx = { selection = 1 dpy = 0x312528 widget = 0x3245c0 time = 1304501801 convert = &convert() at 0x112618 loses = &lose() at 0x11298c notify = &done() at 0x112b94 owner_cancel = (nil) owner_closure = (nil) prop_list = 0x380f48 req = (nil) ref_count = 0 incremental = 0 free_when_done = 0 was_disowned = 1 } (dbx) p *info->ctx->prop_list *`Selection`ReqCleanup`info->ctx->prop_list = { dpy = 0x312528 incremental_atom = 114 indirect_atom = 115 timestamp_atom = 167 propCount = 1 list = 0x380f68 } (dbx) sh xlsatoms -range 114-115 114 INCR 115 MULTIPLE (dbx) sh xlsatoms -range 167-167 167 TIMESTAMP (dbx) next X Error: BadAtom Request Major code 20 () Request Minor code 0 ResourceID 0x0 Error Serial #2664 Current Serial #2664 Pat Sherry ArborText, Inc. pms@arbortext.com