This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] fix ref counting of inferior_to_inferior_object
- From: Doug Evans <dje at google dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Wed, 25 Sep 2013 11:18:04 -0700
- Subject: Re: [RFA] fix ref counting of inferior_to_inferior_object
- Authentication-results: sourceware.org; auth=none
- References: <yjt2zjrhekva dot fsf at ruffy dot mtv dot corp dot google dot com> <87hadbmfsr dot fsf at fleche dot redhat dot com>
On Mon, Sep 23, 2013 at 1:41 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> While adding an inferior attribute to the newobjfile event,
> Doug> I noticed inferior_to_inferior_object sometimes returns (AFAICT)
> Doug> a new reference and sometimes returns a borrowed reference.
>
> The current code is maybe weird but I think it isn't incorrect. That
> said it is fine to change it as well.
>
> The current model is that the Python object mirroring the inferior
> clears the inferior->Python mapping when it is finally destroyed.
> If the Python code then requests the Python object for that inferior
> again, a new object is created. This is "ok" because the Inferior
> object doesn't carry any user state.
Doesn't the caller always need to know whether s/he is getting a new
reference or a borrowed reference?
How will s/he keep the reference count correct?
[maybe I'm misunderstanding the terms used here]