Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mailrus!cs.utexas.edu!rice!sun-spots-request From: ych@maps.cs.cmu.edu (Yuan Hsieh) Newsgroups: comp.sys.sun Subject: Sunview Programing Question/Problem Keywords: Windows Message-ID: <3797@brazos.Rice.edu> Date: 1 Dec 89 19:33:00 GMT Sender: news@rice.edu Organization: Sun-Spots Lines: 44 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 217, message 20 of 23 A questions on Sunview programming concerning use of window_read_event(). I have the following event handler for a canvas window: canvas_handle_event(canvas,event,arg) { ... switch(event_acton(event)) { ... case 'Z': z_proc(canvas); break; ... } ... } When event 'Z' occurs, z_proc() is called and is defined as follows: [z_proc() is suppose to wait for a 'down' event to occur.] z_proc(canvas) { ... while(1) { if ((winderr = window_read_event(canvas,event)) == 0) { if (event_is_down(event)) break; } else if (winderr == -1) { printf("errno:%d\n",errno); } } ... } Problem: if 'Z' event is the first thing I do, z_proc() executes with no fault. But if there are any other event before 'Z', window_read_event() returns -1 with errno of 14 which is, (according to man 2 intro): 14 EFAULT Bad address The system encountered a hardware fault in attempting to access the arguments of a system call. I am pretty sure all other parts of my program does not affect this at all. Anyone know what this means? Am I missing something? Please reply to ych@maps.cs.cmu.edu.. Thanks.