Skip to content
  • Chad Versace's avatar
    waffle: Fix waffle_*_get_native functions · b072d9ee
    Chad Versace authored
    
    
    This patch fixes all waffle_*_get_native functions for glx, x11_egl, and
    wayland. The functions never did work because I incorrectly implemented
    them like this:
    
        union waffle_native_display*
        glx_display_get_native(...)
        {
            struct waffle_glx_display *n_dpy = malloc(sizeof(*n_dpy));
            [fill n_dpy];
            return (union waffle_native_display*) n_dpy;
        }
    
    That implementation would have been correct if the union were defined as:
    
        union waffle_native_display {
            struct waffle_glx_display glx;
            ...
        };
    
    Instead, the union is defined as:
    
        union waffle_native_display {
            struct waffle_glx_display *glx;
            ...
        };
    
    Therefore, the correct implementation looks like this, modulo error
    checking:
    
        union waffle_native_display*
        glx_display_get_native(...)
        {
            union waffle_native_display *n_dpy = malloc(sizeof(*n_dpy));
            n_dpy->glx = malloc(sizeof(*n_dpy->glx));
            [fill n_dpy->glx];
            return n_dpy;
        }
    
    Signed-off-by: default avatarChad Versace <chad.versace@linux.intel.com>
    b072d9ee