summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-10-21 11:57:15 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-11-10 11:31:05 -0500
commit70f479c6f8bf976ca680fd53d655ccec56b3f12e (patch)
treeed15efcf7b0eac1412fe887cad289972479daa62
parent041de3d73aa121f2ff0c077213598963bfb34b79 (diff)
downloadbinutils-gdb-70f479c6f8bf976ca680fd53d655ccec56b3f12e.tar.gz
gdb: clear other.m_cached_id in frame_info_ptr's move ctor
We do it in the move assignment operator, so I think it makes sense to do it here too for consistency. I don't think it's absolutely necessary to clear the other object's fields (in other words, copy constructor and move constructor could be the same), as there is no exclusive resource being transfered. The important thing is to leave the moved-from object in an unknown, but valid state. But still, I think that clearing the fields of the moved-from object is not a bad idea, it helps ensure we don't rely on the moved-from object after. Change-Id: Iee900ff9d25dad51d62765d694f2e01524351340 Reviewed-By: Bruno Larsen <blarsen@redhat.com>
-rw-r--r--gdb/frame-info.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/frame-info.h b/gdb/frame-info.h
index 665f4bdae3b..7159f82b196 100644
--- a/gdb/frame-info.h
+++ b/gdb/frame-info.h
@@ -71,6 +71,7 @@ public:
: m_ptr (other.m_ptr), m_cached_id (other.m_cached_id)
{
other.m_ptr = nullptr;
+ other.m_cached_id = null_frame_id;
frame_list.push_back (*this);
}