public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: clear other.m_cached_id in frame_info_ptr's move ctor Date: Thu, 10 Nov 2022 16:33:50 +0000 (GMT) [thread overview] Message-ID: <20221110163350.ADB5F3858D20@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=70f479c6f8bf976ca680fd53d655ccec56b3f12e commit 70f479c6f8bf976ca680fd53d655ccec56b3f12e Author: Simon Marchi <simon.marchi@polymtl.ca> Date: Fri Oct 21 11:57:15 2022 -0400 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> Diff: --- gdb/frame-info.h | 1 + 1 file changed, 1 insertion(+) 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); }
reply other threads:[~2022-11-10 16:33 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221110163350.ADB5F3858D20@sourceware.org \ --to=simark@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).