This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] fix ref counting of inferior_to_inferior_object


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]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]