void DRISurfaceNotify(xp_surface_id id, int kind) { DRIDrawablePrivPtr pDRIDrawablePriv = NULL; DRISurfaceNotifyArg arg; arg.id = id; arg.kind = kind; if (surface_hash != NULL) { pDRIDrawablePriv = x_hash_table_lookup(surface_hash, (void *) id, NULL); } if (pDRIDrawablePriv == NULL) return; if (kind == AppleDRISurfaceNotifyDestroyed) { pDRIDrawablePriv->sid = 0; x_hash_table_remove(surface_hash, (void *) id); } x_hook_run(pDRIDrawablePriv->notifiers, &arg); if (kind == AppleDRISurfaceNotifyDestroyed) { /* Kill off the handle. */ FreeResourceByType(pDRIDrawablePriv->pDraw->id, DRIDrawablePrivResType, FALSE); } }
/* * Note: this also cleans up the hash table in addition to notifying clients. * The sid/surface-id should not be used after this, because it will be * invalid. */ void DRISurfaceNotify(xp_surface_id id, int kind) { DRIDrawablePrivPtr pDRIDrawablePriv = NULL; DRISurfaceNotifyArg arg; arg.id = id; arg.kind = kind; if (surface_hash != NULL) { pDRIDrawablePriv = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(id), NULL); } if (pDRIDrawablePriv == NULL) return; if (kind == AppleDRISurfaceNotifyDestroyed) { x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(id)); } x_hook_run(pDRIDrawablePriv->notifiers, &arg); if (kind == AppleDRISurfaceNotifyDestroyed) { xp_error error; error = xp_destroy_surface(pDRIDrawablePriv->sid); if(error) ErrorF("%s: xp_destroy_surface failed: %d\n", __func__, error); /* Guard against reuse, even though we are freeing after this. */ pDRIDrawablePriv->sid = 0; FreeResourceByType(pDRIDrawablePriv->pDraw->id, DRIDrawablePrivResType, FALSE); } }