On Tue, 2018-02-13 at 10:33 +0100, Michal Srb wrote:
> Otherwise X server crashes if GLX is enabled and Composite disabled. For
> example the compIsAlternateVisual function will try to lookup CompScreenPtr
> using the CompScreenPrivateKey, but that was never initialized if Composite is
> disabled.

I've hit enough cases like this that I think we should consider
changing dixLookupPrivate thus:

---
diff --git a/include/privates.h b/include/privates.h
index e89c3e440..f34c32fd3 100644
--- a/include/privates.h
+++ b/include/privates.h
@@ -155,12 +155,14 @@ dixSetPrivate(PrivatePtr *privates, const DevPrivateKey 
key, void *val)
  *
  * For privates with defined storage, return the address of the
  * storage. For privates without defined storage, return the pointer
- * contents
+ * contents. If the key is not yet set up return NULL.
  */
 static inline void *
 dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key)
 {
-    if (key->size)
+    if (!key->initialized)
+        return NULL;
+    else if (key->size)
         return dixGetPrivateAddr(privates, key);
     else
         return dixGetPrivate(privates, key);
---

I think if we'd done that I wouldn't have needed to back out v3 of the
"RANDR disabling" patch.

- ajax
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to