Hi,

I think I found the bug that causes crashes in X for some people.

If X started crashing since you upgraded to the last snapshots, can
you try the patch below ?

get /usr/xenocara from CVS then

cd /usr/xenocara/xserver
patch -p0 -E < /this/patch
doas make -f Makefile.bsd-wrapper obj
doas make -f Makefile.bsd-wrapper build

And restart the X server, for example : 
doas rcctl restart xenodm

Index: dix/events.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/dix/events.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 events.c
--- dix/events.c        11 Nov 2021 09:03:03 -0000      1.22
+++ dix/events.c        16 Nov 2021 22:15:06 -0000
@@ -1319,7 +1319,7 @@ ComputeFreezes(void)
 
         syncEvents.replayDev = (DeviceIntPtr) NULL;
 
-        if (!CheckDeviceGrabs(replayDev, &event->device_event,
+        if (!CheckDeviceGrabs(replayDev, event,
                               syncEvents.replayWin)) {
             if (IsTouchEvent(event)) {
                 TouchPointInfoPtr ti =
@@ -3027,7 +3027,7 @@ BOOL
 ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
 {
     BOOL rc = FALSE;
-    DeviceEvent event;
+    InternalEvent event;
 
     if (dev->deviceGrab.grab) {
         if (!dev->deviceGrab.fromPassiveGrab ||
@@ -3042,16 +3042,16 @@ ActivateFocusInGrab(DeviceIntPtr dev, Wi
     if (win == NoneWin || win == PointerRootWin)
         return FALSE;
 
-    event = (DeviceEvent) {
-        .header = ET_Internal,
-        .type = ET_FocusIn,
-        .length = sizeof(DeviceEvent),
-        .time = GetTimeInMillis(),
-        .deviceid = dev->id,
-        .sourceid = dev->id,
-        .detail.button = 0
+    event = (InternalEvent) {
+        .device_event.header = ET_Internal,
+        .device_event.type = ET_FocusIn,
+        .device_event.length = sizeof(DeviceEvent),
+        .device_event.time = GetTimeInMillis(),
+        .device_event.deviceid = dev->id,
+        .device_event.sourceid = dev->id,
+        .device_event.detail.button = 0
     };
-    rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
+    rc = (CheckPassiveGrabsOnWindow(win, dev, &event, FALSE,
                                     TRUE) != NULL);
     if (rc)
         DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab);
@@ -3068,7 +3068,7 @@ static BOOL
 ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
 {
     BOOL rc = FALSE;
-    DeviceEvent event;
+    InternalEvent event;
 
     if (dev->deviceGrab.grab) {
         if (!dev->deviceGrab.fromPassiveGrab ||
@@ -3080,16 +3080,16 @@ ActivateEnterGrab(DeviceIntPtr dev, Wind
         (*dev->deviceGrab.DeactivateGrab) (dev);
     }
 
-    event = (DeviceEvent) {
-        .header = ET_Internal,
-        .type = ET_Enter,
-        .length = sizeof(DeviceEvent),
-        .time = GetTimeInMillis(),
-        .deviceid = dev->id,
-        .sourceid = dev->id,
-        .detail.button = 0
+    event = (InternalEvent) {
+        .device_event.header = ET_Internal,
+        .device_event.type = ET_Enter,
+        .device_event.length = sizeof(DeviceEvent),
+        .device_event.time = GetTimeInMillis(),
+        .device_event.deviceid = dev->id,
+        .device_event.sourceid = dev->id,
+        .device_event.detail.button = 0
     };
-    rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
+    rc = (CheckPassiveGrabsOnWindow(win, dev, &event, FALSE,
                                     TRUE) != NULL);
     if (rc)
         DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab);
@@ -4141,14 +4141,15 @@ CheckPassiveGrabsOnWindow(WindowPtr pWin
 */
 
 Bool
-CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor)
+CheckDeviceGrabs(DeviceIntPtr device, InternalEvent *ievent, WindowPtr 
ancestor)
 {
     int i;
     WindowPtr pWin = NULL;
     FocusClassPtr focus =
-        IsPointerEvent((InternalEvent *) event) ? NULL : device->focus;
+        IsPointerEvent(ievent) ? NULL : device->focus;
     BOOL sendCore = (IsMaster(device) && device->coreEvents);
     Bool ret = FALSE;
+    DeviceEvent *event = &ievent->device_event;
 
     if (event->type != ET_ButtonPress && event->type != ET_KeyPress)
         return FALSE;
@@ -4171,7 +4172,7 @@ CheckDeviceGrabs(DeviceIntPtr device, De
     if (focus) {
         for (; i < focus->traceGood; i++) {
             pWin = focus->trace[i];
-            if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) 
event,
+            if (CheckPassiveGrabsOnWindow(pWin, device, ievent,
                                           sendCore, TRUE)) {
                 ret = TRUE;
                 goto out;
@@ -4186,7 +4187,7 @@ CheckDeviceGrabs(DeviceIntPtr device, De
 
     for (; i < device->spriteInfo->sprite->spriteTraceGood; i++) {
         pWin = device->spriteInfo->sprite->spriteTrace[i];
-        if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event,
+        if (CheckPassiveGrabsOnWindow(pWin, device, ievent,
                                       sendCore, TRUE)) {
             ret = TRUE;
             goto out;
Index: include/dix.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/include/dix.h,v
retrieving revision 1.17
diff -u -p -u -r1.17 dix.h
--- include/dix.h       11 Nov 2021 09:03:13 -0000      1.17
+++ include/dix.h       16 Nov 2021 22:03:19 -0000
@@ -458,7 +458,7 @@ WindowHasNewCursor(WindowPtr /* pWin */ 
 
 extern Bool
 CheckDeviceGrabs(DeviceIntPtr /* device */ ,
-                 DeviceEvent * /* event */ ,
+                 InternalEvent * /* event */ ,
                  WindowPtr /* ancestor */ );
 
 extern void

-- 
Matthieu Herrb

Reply via email to