Re: segmentation fault (nullpointer) with git log --submodule -p
- From
- Jonathon Mah <jmah@me.com>
- Date
- Jan 25, 2013, 07:32 UTC
- Message-ID
- <FE6CC927-1915-4486-BBB8-4C109F7B5295@me.com>
- In-Reply-To
- <20130125055331.GC26524@elie.Belkin>
Just to note, the proposals so far don't prevent a "smart-ass" function from freeing the buffer when it's called underneath the use/release scope, as in:
with_commit_buffer(commit); {
fn1_needing_buffer(commit);
walk_rev_tree_or_something();
fn2_needing_buffer(commit);
} done_with_commit_buffer(commit);walk_rev_tree_or_something() might need to read commits to do its thing, and it could still choose to free their buffers (as in rev-list.c finish_commit()). If those commits includes the one being "retained", the call to fn2 will still see NULL despite it being in a 'protected scope'.
Are the objections to using a reference count?
Jonathon Mah me@JonathonMah.com