+2020-12-11 Tom Tromey <tom@tromey.com>
+
+ * varobj.c (install_dynamic_child, varobj_clear_saved_item)
+ (update_dynamic_varobj_children, create_child)
+ (create_child_with_value): Update.
+ * varobj-iter.h (struct varobj_item) <value>: Now a
+ value_ref_ptr.
+ * python/py-varobj.c (py_varobj_iter::next): Call release_value.
+
2020-12-11 Tom Tromey <tom@tromey.com>
* varobj.c (struct varobj_dynamic) <child_iter>: Now unique_ptr.
else
{
varobj *existing = var->children[index];
- bool type_updated = update_type_if_necessary (existing, item->value);
+ bool type_updated = update_type_if_necessary (existing,
+ item->value.get ());
if (type_updated)
{
if (type_changed != NULL)
type_changed->push_back (existing);
}
- if (install_new_value (existing, item->value, 0))
+ if (install_new_value (existing, item->value.get (), 0))
{
if (!type_updated && changed != NULL)
changed->push_back (existing);
varobj_clear_saved_item (struct varobj_dynamic *var)
{
if (var->saved_item != NULL)
- {
- value_decref (var->saved_item->value);
- var->saved_item.reset (nullptr);
- }
+ var->saved_item.reset (nullptr);
}
static bool
if (var->dynamic->saved_item != NULL)
item = std::move (var->dynamic->saved_item);
else
- {
- item = var->dynamic->child_iter->next ();
- /* Release vitem->value so its lifetime is not bound to the
- execution of a command. */
- if (item != NULL && item->value != NULL)
- item->value = release_value (item->value).release ();
- }
+ item = var->dynamic->child_iter->next ();
if (item == NULL)
{
struct varobj_item item;
std::swap (item.name, name);
- item.value = value_of_child (parent, index);
+ item.value = release_value (value_of_child (parent, index));
return create_child_with_value (parent, index, &item);
}
if (item->value != NULL)
/* If the child had no evaluation errors, var->value
will be non-NULL and contain a valid type. */
- child->type = value_actual_type (item->value, 0, NULL);
+ child->type = value_actual_type (item->value.get (), 0, NULL);
else
/* Otherwise, we must compute the type. */
child->type = (*child->root->lang_ops->type_of_child) (child->parent,
child->index);
- install_new_value (child, item->value, 1);
+ install_new_value (child, item->value.get (), 1);
return child;
}