#449 closed defect (fixed)
some psArray functions don't handle reference counting
| Reported by: | jhoblitt | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | types | Version: | 0.6.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
psArrayRemove() - does not call psFree()
psArraySet() - does not call psMemIncrRefCounter() on new values / does not call
psFree() on replaced values
psArrayGet() - does not call psMemIncrRefCounter()
I'm a little unsure of what psArrayGet() should do as I'm not sure how it fits
into the scheme of views vs. control. My feeling is that it should call
psMemIncrRefCounter() and that this should be clearly documented. If a 'view
only' accessor is needed then we can add something like psArrayLookup().
Change History (6)
comment:1 by , 21 years ago
comment:3 by , 21 years ago
| Status: | new → assigned |
|---|
comment:4 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Added decrement of reference in psArrayRemove
Added increment of reference in psArrayGet, psArraySet.
Verified that psArrayAdd properly incremented.
Modified psImage and psList, users of these functions, to now account for the reference counting for
sub-images and iterators, respectively.
Fixes are in CVS.

I think we decided that all collection functions should implement reference
counting. So if you pull something off a collection using a psLib API (e.g.,
psArrayGet), the reference counter should be incremented and it is the users job
to psFree it when done.
I am loath to have a "view only" accessor --- I think it is important to have a
single blanket policy for this.