XWorkstation.st
changeset 1521 23aacd62bbac
parent 1511 978a3b73b657
child 1533 18e7a458b625
--- a/XWorkstation.st	Wed Apr 02 20:16:52 1997 +0200
+++ b/XWorkstation.st	Wed Apr 02 20:46:45 1997 +0200
@@ -3488,6 +3488,7 @@
     Display *dpy;
     OBJ eB;
     XEvent *ev;
+    int ev_x, ev_y;
 
 #   define ae ((XAnyEvent *)ev)
 #   define ee ((XExposeEvent *)ev)
@@ -3582,6 +3583,11 @@
     if (theView == nil) {
         windowID = __MKOBJ(ae->window);
         theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID);
+	/*
+	 * #viewFromId: could lead to a GC - refetch event ptr
+	 */
+        eB = __INST(eventBuffer);
+	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
     }
 
     if ((theView == nil) && (ev->type != MappingNotify)) {
@@ -3630,6 +3636,9 @@
             __INST(shiftDown) = (ke->state & ShiftMask) ? true : false;
             __INST(ctrlDown) = (ke->state & ControlMask) ? true : false;
 
+            ev_x = ke->x;
+            ev_y = ke->y;
+
             arg = nil;
             nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
             if (nchars 
@@ -3686,9 +3695,7 @@
                     }
                     arg = __MKSYMBOL(keySymString, (OBJ *)0, __context);
 #else
-                    __PROTECT__(theView);
                     arg = __MKSTRING(keySymString);
-                    __UNPROTECT__(theView);
 #endif
                 }
             }
@@ -3700,8 +3707,8 @@
 
             (*(*ipS).ilc_func)(self, symS, nil, ipS,
                                arg, 
-                               __MKSMALLINT(ke->x), 
-                               __MKSMALLINT(ke->y),
+                               __MKSMALLINT(ev_x), 
+                               __MKSMALLINT(ev_y),
                                theView);
             break;
 
@@ -3722,6 +3729,11 @@
                 _multiClickTime = __longIntVal(t);
                 if (be->time < _multiClickTime) {
                     __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
+	            /*
+	             * MKUINT could lead to a GC - refetch event ptr
+	             */
+        	    eB = __INST(eventBuffer);
+	            ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
 
                     ipS = &bmpS;
                     symS = @symbol(buttonMultiPress:x:y:view:);
@@ -3730,6 +3742,11 @@
                 }
             }
             __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
+	    /*
+	     * MKUINT could lead to a GC - refetch event ptr
+	     */
+            eB = __INST(eventBuffer);
+	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
 
 #ifdef NO_LONGER
             if (be->state & ShiftMask) {
@@ -3763,6 +3780,11 @@
             else 
 #endif
                 butt = __AT_(__INST(buttonTranslation), butt);
+	    /*
+	     * #at: could lead to a GC - refetch event ptr
+	     */
+            eB = __INST(eventBuffer);
+	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
 
 
             (*(*ipS).ilc_func)(self, 
@@ -3872,6 +3894,11 @@
             if (ce->above != None) {
                 siblingID = __MKOBJ(ce->above);
                 sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID);
+	        /*
+	         * MKOBJ or #viewFromId: could lead to a GC - refetch event ptr
+	         */
+                eB = __INST(eventBuffer);
+	        ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
             }
 
             (*confS.ilc_func)(self, 
@@ -8606,6 +8633,6 @@
 !XWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.220 1997-04-02 10:58:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.221 1997-04-02 18:46:45 cg Exp $'
 ! !
 XWorkstation initialize!