http://www.squid-cache.org/Versions/v3/HEAD/changesets/11438.patch

This is plain wrong use of cbdataReference(). cbdataReference returns a
reference to the cbdata object, and you are meant to use
cbdataReferenceDone on that reference when done.

The current implementation happens to return the same pointer due to
historical reasons, but this should not be counted on.

If you need to manually lock/unlock cbdata objects for whatever stange
reason then use the cbdataInternalLock/Unlock calls.

The idea with cbdata is that when you are given a cbdata enabled object
use cbdataReference on it to get a reference safe to be saved between
call events. Then use cbdataReferenceValid to verify it's validity if
needed, cbdataReferenceDone() to get rid of the reference (also kills
the pointer to avoid "reuse after free), or cbdataReferenceValidDone()
to do both in one step suitable for calling a callback with the cbdata
variable as argument, or other similar chain of events.


I haven't yet analyzed this code to tell if it should use cbdataInternal
as a workaround for a race condition or if it's a design error in how
EventDialer uses cbdata. Saw it while working wiht Amos to sort out what
changesets should be merged back to 3.0..


Regards
Henrik


Attachment: signature.asc
Description: Detta är en digitalt signerad meddelandedel

Reply via email to