X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fwinsys%2Fdrm%2Fvmware%2Fcore%2Fvmw_surface.c;h=5f1b9ad577093dd49099fc6d02f46fb0728970a2;hb=eb4dc547885994cc7961f7996c33ff484f664964;hp=9ec4bf927261bd8c0e9f096b0fd451ffdc9fc4e2;hpb=3192633d4abe262d413e41feb871fe8deed409d8;p=mesa.git diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.c b/src/gallium/winsys/drm/vmware/core/vmw_surface.c index 9ec4bf92726..5f1b9ad5770 100644 --- a/src/gallium/winsys/drm/vmware/core/vmw_surface.c +++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.c @@ -37,15 +37,17 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst, { struct pipe_reference *src_ref; struct pipe_reference *dst_ref; - struct vmw_svga_winsys_surface *dst = *pdst; - - if(*pdst == src || pdst == NULL) + struct vmw_svga_winsys_surface *dst; + + if(pdst == NULL || *pdst == src) return; - + + dst = *pdst; + src_ref = src ? &src->refcnt : NULL; dst_ref = dst ? &dst->refcnt : NULL; - if (pipe_reference(&dst_ref, src_ref)) { + if (pipe_reference(dst_ref, src_ref)) { vmw_ioctl_surface_destroy(dst->screen, dst->sid); #ifdef DEBUG /* to detect dangling pointers */