glx: Don't create a shared context if the other context isn't the same kind
[mesa.git] / src / glx / dri_glx.c
index 666423a7b1577ea6b08c9e5db9e8bbecfb9ac289..9365224a69643e34791fddbc38f22f68e0346a54 100644 (file)
@@ -587,6 +587,13 @@ dri_create_context(struct glx_screen *base,
       return NULL;
 
    if (shareList) {
+      /* If the shareList context is not a DRI context, we cannot possibly
+       * create a DRI context that shares it.
+       */
+      if (shareList->vtable->destroy != dri_destroy_context) {
+        return NULL;
+      }
+
       pcp_shared = (struct dri_context *) shareList;
       shared = pcp_shared->driContext;
    }