[
https://issues.apache.org/jira/browse/CLOWNFISH-37?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nick Wellnhofer resolved CLOWNFISH-37.
--------------------------------------
Resolution: Fixed
I reviewed every single call to {{DECREF}} in the Clownfish code base and I
couldn't find any problematic ones.
The following functions/methods take decremented arguments, so this isn't an
issue:
- Err_set_error
- Hash_Store
- Vec_Store
The only other method is {{StrIter_Assign}} which already handles this case
properly.
> Order of refcount manipulation when overwriting
> -----------------------------------------------
>
> Key: CLOWNFISH-37
> URL: https://issues.apache.org/jira/browse/CLOWNFISH-37
> Project: Apache Lucy-Clownfish
> Issue Type: Bug
> Components: Core
> Reporter: Marvin Humphrey
> Priority: Minor
> Fix For: 0.5.0
>
>
> There are a number of places in Clownfish where we decref a member variable
> then overwrite it with an incref'd argument. This can cause problem if for
> example a value overwrites itself, because the decref can cause the refcount
> to fall to 0.
> We should instead first capture the incref to a temp variable, then decref,
> then overwrite.
> {code}
> void
> Foo_Set_Thing_IMP(Foo *self, Obj *thing) {
> - DECREF(self->thing);
> - self->thing = INCREF(thing);
> + Obj *temp = INCREF(thing);
> + DECREF(self->thing);
> + self->thing = temp;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)