diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-09-14 13:04:14 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-09-14 13:04:14 +0100 |
commit | d2dbb991384f2b820a714eba262691ed97a6a22a (patch) | |
tree | f41138d29f49cc2129ccb87fea53855814ba162f | |
parent | d8756091474aeb44e5d8eed6b20b65c23b6574e7 (diff) |
sna/dri: Add a bunch of assertions for hunting a use-after-free
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_display.c | 1 | ||||
-rw-r--r-- | src/sna/sna_dri.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 36122e2b..a0129e40 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -2495,6 +2495,7 @@ sna_page_flip(struct sna *sna, int count; DBG(("%s: handle %d attached\n", __FUNCTION__, bo->handle)); + assert(bo->refcnt); kgem_submit(&sna->kgem); diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index ff6b5871..de0f84da 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -115,6 +115,7 @@ get_private(DRI2Buffer2Ptr buffer) static inline struct kgem_bo *ref(struct kgem_bo *bo) { + assert(bo->refcnt); bo->refcnt++; return bo; } @@ -877,6 +878,8 @@ sna_dri_remove_frame_event(WindowPtr win, while (chain->chain != info) chain = chain->chain; + assert(chain != info); + assert(info->chain != chain); chain->chain = info->chain; } @@ -912,8 +915,11 @@ sna_dri_add_frame_event(DrawablePtr draw, struct sna_dri_frame_event *info) return; } + assert(chain != info); while (chain->chain != NULL) chain = chain->chain; + + assert(chain != info); chain->chain = info; } @@ -2031,6 +2037,7 @@ blit: CREATE_SCANOUT | CREATE_EXACT); name = kgem_bo_flink(&sna->kgem, bo); } + assert(bo->refcnt); get_private(info->back)->bo = bo; info->back->name = name; |