diff options
author | Tony Lindgren <tony@atomide.com> | 2020-02-04 10:33:58 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-08-21 12:35:40 -0700 |
commit | 2cbb5ddc525b93be221e52b2eade77861408a6db (patch) | |
tree | 4813e42371c95681df98392a33f28eda5614220f | |
parent | 689522257c211866f407636077511682ad792fd2 (diff) |
omap: Fix missing usage count decrease in OMAPDRI2DestroyBuffer
Commit 0bdd370ab720 ("dri2: hold extra buffer ref during swap") started
increasing pPixmap->refcnt for DRI2BufferFrontLeft, but that gets never
decremented in OMAPDRI2DestroyBuffer.
Let's fix the issue by pairing the increment with a decrement in
OMAPDRI2DestroyBuffer. Otherwise we get a segfault after rotating an
sgx accelerated opengl es app and then terminating it.
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | src/omap_dri2.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/omap_dri2.c b/src/omap_dri2.c index dd3895c..a81e3c9 100644 --- a/src/omap_dri2.c +++ b/src/omap_dri2.c @@ -316,7 +316,11 @@ OMAPDRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer) pPriv->pThirdBuffer = NULL; } - pScreen->DestroyPixmap(buf->pPixmap); + /* Pair refcount increment done in OMAPDRI2CreateBuffer */ + if (buffer->attachment == DRI2BufferFrontLeft && buf->pPixmap->refcnt) + buf->pPixmap->refcnt--; + else + pScreen->DestroyPixmap(buf->pPixmap); free(buf); } |