diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-03-26 10:44:55 -0700 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-03-26 10:46:43 -0700 |
commit | df3b26847914557eb3c9c70732d91169b1936d77 (patch) | |
tree | 3f26406433773cb6940e1c016e98cae97f26e7eb | |
parent | 362a49e71fc41541b6dc121660d98e29da4b14e8 (diff) |
DRI2: release our private front buffer ref when buffer swapping
Pauli pointed out that we take a ref on the front buffer when exchanging
but forget to release it. The ref is necessary since the set functions
will drop refs as necessary, but once we set the front buffer to point
at the back pixmap, we ned to release our private ref again, or we'll
leak buffers.
Reported-by: Pauli Nieminen <suokkos@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r-- | src/i830_dri.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/i830_dri.c b/src/i830_dri.c index 7c595dd9..321faf60 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -446,12 +446,17 @@ I830DRI2ExchangeBuffers(DrawablePtr draw, DRI2BufferPtr front, back->name = tmp; /* Swap pixmap bos */ + + /* Hold a ref on the front so the set calls below don't destroy it */ dri_bo_reference(i830_get_pixmap_bo(front_priv->pixmap)); tmp_bo = i830_get_pixmap_bo(front_priv->pixmap); i830_set_pixmap_bo(front_priv->pixmap, i830_get_pixmap_bo(back_priv->pixmap)); i830_set_pixmap_bo(back_priv->pixmap, tmp_bo); /* should be screen */ + + /* Release our ref, the last set should have bumped it */ + dri_bo_unreference(tmp_bo); } /* |