diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 6c4dabc..a8a473e 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -772,6 +772,12 @@ DRI2HasSwapControl(ScreenPtr pScreen) return (ds->ScheduleSwap && ds->GetMSC); } +void +DRI2DestroyDrawable(DrawablePtr pDraw) +{ + FreeResourceByType(pDraw->id, dri2DrawableRes, FALSE); +} + Bool DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd, const char **driverName, const char **deviceName) diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index 17df130..a15df06 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -167,6 +167,9 @@ ProcDRI2CreateDrawable(ClientPtr client) &pDrawable, &status)) return status; + if (pDrawable->id == 0) + pDrawable->id = stuff->drawable; + status = DRI2CreateDrawable(pDrawable); if (status != Success) return status; @@ -186,6 +189,8 @@ ProcDRI2DestroyDrawable(ClientPtr client) &pDrawable, &status)) return status; + DRI2DestroyDrawable(pDrawable); + return client->noClientException; }