forked from Imagelibrary/binutils-gdb
PR python/12533:
* value.h (release_value_or_incref): Declare. * value.c (struct value) <released>: New field. (free_all_values, release_value, value_release_to_mark): Update 'released'. (release_value_or_incref): New function. * python/py-value.c (valpy_new): Use release_value_or_incref. (value_to_value_object): Likewise. * varobj.c (install_new_value): Move value_incref earlier.
This commit is contained in:
@@ -1604,6 +1604,10 @@ install_new_value (struct varobj *var, struct value *value, int initial)
|
||||
}
|
||||
}
|
||||
|
||||
/* Get a reference now, before possibly passing it to any Python
|
||||
code that might release it. */
|
||||
if (value != NULL)
|
||||
value_incref (value);
|
||||
|
||||
/* Below, we'll be comparing string rendering of old and new
|
||||
values. Don't get string rendering if the value is
|
||||
@@ -1671,8 +1675,6 @@ install_new_value (struct varobj *var, struct value *value, int initial)
|
||||
if (var->value != NULL && var->value != value)
|
||||
value_free (var->value);
|
||||
var->value = value;
|
||||
if (value != NULL)
|
||||
value_incref (value);
|
||||
if (value && value_lazy (value) && intentionally_not_fetched)
|
||||
var->not_fetched = 1;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user