+2013-05-06 Tom Tromey <tromey@redhat.com>
+
+ * ada-lang.c (ada_value_primitive_packed_val): Don't
+ call value_incref.
+ * value.c (set_value_parent): Incref the new parent and decref
+ the old parent.
+ (value_copy, value_primitive_field): Use set_value_parent.
+
2013-05-06 Tom Tromey <tromey@redhat.com>
* dwarf2loc.c (invalid_synthetic_pointer): Move earlier.
/* Also set the parent value. This is needed when trying to
assign a new value (in inferior memory). */
set_value_parent (v, obj);
- value_incref (obj);
}
else
set_value_bitsize (v, bit_size);
void
set_value_parent (struct value *value, struct value *parent)
{
+ struct value *old = value->parent;
+
value->parent = parent;
+ if (parent != NULL)
+ value_incref (parent);
+ value_free (old);
}
gdb_byte *
}
val->unavailable = VEC_copy (range_s, arg->unavailable);
- val->parent = arg->parent;
- if (val->parent)
- value_incref (val->parent);
+ set_value_parent (val, arg->parent);
if (VALUE_LVAL (val) == lval_computed)
{
const struct lval_funcs *funcs = val->location.computed.funcs;
v->offset = (value_embedded_offset (arg1)
+ offset
+ (bitpos - v->bitpos) / 8);
- v->parent = arg1;
- value_incref (v->parent);
+ set_value_parent (v, arg1);
if (!value_lazy (arg1))
value_fetch_lazy (v);
}