mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-16 08:30:28 +01:00
Change DRI2SwapComplete() to not take a DrawablePtr, which may have been freed
This commit is contained in:
parent
219729033e
commit
d8342156dd
2 changed files with 15 additions and 7 deletions
|
|
@ -394,7 +394,7 @@ DRI2SwapBuffers(DrawablePtr pDraw)
|
|||
return BadValue;
|
||||
|
||||
if (DRI2FlipCheck(pDraw) &&
|
||||
(*ds->SwapBuffers)(pDraw, pDestBuffer, pSrcBuffer))
|
||||
(*ds->SwapBuffers)(pDraw, pDestBuffer, pSrcBuffer, pPriv))
|
||||
{
|
||||
pPriv->swapPending = TRUE;
|
||||
return Success;
|
||||
|
|
@ -430,15 +430,18 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
|
|||
}
|
||||
|
||||
void
|
||||
DRI2SwapComplete(DrawablePtr pDrawable)
|
||||
DRI2SwapComplete(void *data)
|
||||
{
|
||||
DRI2DrawablePtr pPriv = DRI2GetDrawable(pDrawable);
|
||||
DRI2DrawablePtr pPriv = data;
|
||||
|
||||
if (pPriv->blockedClient)
|
||||
AttendClient(pPriv->blockedClient);
|
||||
|
||||
pPriv->swapPending = FALSE;
|
||||
pPriv->blockedClient = NULL;
|
||||
|
||||
if (pPriv->refCount == 0)
|
||||
xfree(pPriv);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -466,7 +469,11 @@ DRI2DestroyDrawable(DrawablePtr pDraw)
|
|||
xfree(pPriv->buffers);
|
||||
}
|
||||
|
||||
xfree(pPriv);
|
||||
/* If the window is destroyed while we have a swap pending, don't
|
||||
* actually free the priv yet. We'll need it in the DRI2SwapComplete()
|
||||
* callback and we'll free it there once we're done. */
|
||||
if (!pPriv->swapPending)
|
||||
xfree(pPriv);
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ typedef void (*DRI2CopyRegionProcPtr)(DrawablePtr pDraw,
|
|||
DRI2BufferPtr pSrcBuffer);
|
||||
typedef Bool (*DRI2SwapBuffersProcPtr)(DrawablePtr pDraw,
|
||||
DRI2BufferPtr pFrontBuffer,
|
||||
DRI2BufferPtr pBackBuffer);
|
||||
DRI2BufferPtr pBackBuffer,
|
||||
void *data);
|
||||
|
||||
typedef void (*DRI2WaitProcPtr)(WindowPtr pWin,
|
||||
unsigned int sequence);
|
||||
|
|
@ -140,8 +141,8 @@ extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
|
|||
int *width, int *height, unsigned int *attachments, int count,
|
||||
int *out_count);
|
||||
|
||||
extern _X_EXPORT int DRI2SwapBuffers(DrawablePtr pDraw);
|
||||
extern _X_EXPORT int DRI2SwapBuffers(DrawablePtr pDrawable);
|
||||
extern _X_EXPORT Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable);
|
||||
extern _X_EXPORT void DRI2SwapComplete(DrawablePtr pDrawable);
|
||||
extern _X_EXPORT void DRI2SwapComplete(void *data);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue