Xref: utzoo comp.windows.open-look:957 comp.windows.x:34409 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!matrix!hari From: hari@matrix.UUCP (T hariharan) Newsgroups: comp.windows.open-look,comp.windows.x Subject: XView notify problem Keywords: notify, xview Message-ID: <830@matrix.UUCP> Date: 22 Mar 91 23:57:25 GMT Organization: Matrix Computer Systems, Nashua, NH Lines: 76 We've been having a problem with handling XView notification. Setup: ------ We put up a popup with two panel items to prompt for a filename, as shown below: File: ___________________________________ ------ | Load | ------ The PANEL_NOTIFY_PROC's are the same for both the Load button and the Text item (the text items' PANEL_NOTIFY_STRING is "\n\r"). The notify procedure looks somewhat like this (should be easy to guess that it was generated by "guide"): void notify_proc(item, event) Panel_item item; Event *event; { evfile_popup_objects *file_ip = (evfile_popup_objects *) xv_get(item, XV_ KEY_DATA, INSTANCE); char *filename; filename = (char *) xv_get(file_ip->file_text, PANEL_VALUE); load_data(filename); if (xv_get(file_ip->popup, FRAME_CMD_PUSHPIN_IN) == FALSE) xv_destroy_safe(file_ip->popup); } The "evfile_popup_objects" struct is: typedef struct { Xv_opaque popup; Xv_opaque panel; Xv_opaque file_text; Xv_opaque button; } evfile_popup_objects; Problem: -------- If you enter a filename and hit twice in a row quickly, the program crashes. What happens is, after the first , the notify procedure gets called. After it returns, it gets called again, for the second ! During the second call, the program crashes when we check the FRAME_CMD_PUSHPIN_IN attribute. During the first call, the popup gets destroyed, so XView should not have any record of it. But it somehow figures out that the second also belongs to the already destroyed popup. This is possible if XView decides which window a keyboard event should be delivered to as soon as it receives it (as opposed to just putting the event on a queue and deciding later, when processing that event). What's interesting is that, if, instead of typing twice, you press the "Load" button twice in a row, the program does not crash. If you combine and Load, it crashes if the comes after ther Load, but not if it comes before. Given that XView works this way, can anyone suggest a nice workaround ? Please email your responses to me. I'll summarize. Thanks Hari uunet!matrix!hari Matrix Computer Systems, Inc. 7 1/2 Harris Road Nashua NH 03062 (603) 886-3872