+2020-12-11 Tom Tromey <tom@tromey.com>
+
+ * varobj.c (update_dynamic_varobj_children): Update.
+ * varobj-iter.h (struct varobj_iter) <next>: Change return type.
+ * python/py-varobj.c (struct py_varobj_iter) <next>: Change return
+ type.
+ (py_varobj_iter::next): Likewise.
+
2020-12-11 Tom Tromey <tom@tromey.com>
* varobj.c (update_dynamic_varobj_children, install_visualizer)
py_varobj_iter (struct varobj *var, gdbpy_ref<> &&pyiter);
~py_varobj_iter () override;
- varobj_item *next () override;
+ std::unique_ptr<varobj_item> next () override;
private:
/* Implementation of the 'next' method of pretty-printed varobj
iterators. */
-varobj_item *
+std::unique_ptr<varobj_item>
py_varobj_iter::next ()
{
PyObject *py_v;
vitem->name = name;
m_next_raw_index++;
- return vitem;
+ return std::unique_ptr<varobj_item> (vitem);
}
/* Constructor of pretty-printed varobj iterators. VAR is the varobj
virtual ~varobj_iter () = default;
- virtual varobj_item *next () = 0;
+ virtual std::unique_ptr<varobj_item> next () = 0;
};
#endif /* VAROBJ_ITER_H */
are more children. */
for (; to < 0 || i < to + 1; ++i)
{
- varobj_item *item;
+ std::unique_ptr<varobj_item> item;
/* See if there was a leftover from last time. */
if (var->dynamic->saved_item != NULL)
{
- item = var->dynamic->saved_item;
+ item = std::unique_ptr<varobj_item> (var->dynamic->saved_item);
var->dynamic->saved_item = NULL;
}
else
can_mention ? newobj : NULL,
can_mention ? unchanged : NULL,
can_mention ? cchanged : NULL, i,
- item);
-
- delete item;
+ item.get ());
}
else
{
- var->dynamic->saved_item = item;
+ var->dynamic->saved_item = item.release ();
/* We want to truncate the child list just before this
element. */