mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2026-08-27 00:26:02 -04:00
gdb: clear internalvar on destruction
The data associated to an internalvar is destroyed when changing the kind of the internalvar, but not when it is destroyed. Fix that by calling clear_internalvar in ~internalvar. A move constructor becomes needed to avoid freeing things multiple times when internalvars are moved (and if we forget it, clang helpfully gives us a -Wdeprecated-copy-with-user-provided-dtor warning). Change-Id: I427718569208fd955ea25e94d341dde356725033 Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
This commit is contained in:
parent
a7f139db22
commit
bab86877e4
1 changed files with 13 additions and 0 deletions
13
gdb/value.c
13
gdb/value.c
|
|
@ -1872,6 +1872,19 @@ struct internalvar
|
|||
: name (std::move (name))
|
||||
{}
|
||||
|
||||
internalvar (internalvar &&other)
|
||||
: name (std::move(other.name)),
|
||||
kind (other.kind),
|
||||
u (other.u)
|
||||
{
|
||||
other.kind = INTERNALVAR_VOID;
|
||||
}
|
||||
|
||||
~internalvar ()
|
||||
{
|
||||
clear_internalvar (this);
|
||||
}
|
||||
|
||||
std::string name;
|
||||
|
||||
/* We support various different kinds of content of an internal variable.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue