diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-07-16 14:49:52 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-07-17 17:14:42 +0000 |
| commit | 6657146a207834ac44425c01703935dee6d61d41 (patch) | |
| tree | b2c91383efc3705a0952d8ab20830fbec7f6dc79 | |
| parent | shm: get_buffer: purge mismatching buffers in first buffer iteration (diff) | |
shm: chain_free: BUG() if there are buffers remaining after purge
There may be buffers left, if their destruction has been
deferred. However, they should be on the 'deferred' list, not the
chain's buffer list.
If there are buffers left on the chain's list, that means someone
forgot to call shm_unref().
| -rw-r--r-- | shm.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -515,6 +515,11 @@ shm_get_many(struct buffer_chain *chain, size_t count, struct buffer * shm_get_buffer(struct buffer_chain *chain, int width, int height) { + LOG_DBG( + "chain=%p: looking for a re-usable %dx%d buffer " + "among %zu potential buffers", + (void *)chain, width, height, tll_length(chain->bufs)); + struct buffer_private *cached = NULL; tll_foreach(chain->bufs, it) { struct buffer_private *buf = it->item; @@ -919,5 +924,11 @@ shm_chain_free(struct buffer_chain *chain) return; shm_purge(chain); + + if (tll_length(chain->bufs) > 0) { + BUG("chain=%p: there are buffers remaining; " + "is there a missing call to shm_unref()?", (void *)chain); + } + free(chain); } |
