This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 02/12] Generalize varobj iterator
- From: Tom Tromey <tromey at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Wed, 04 Jun 2014 14:20:57 -0600
- Subject: Re: [PATCH 02/12] Generalize varobj iterator
- Authentication-results: sourceware.org; auth=none
- References: <1392367471-13527-1-git-send-email-yao at codesourcery dot com> <1392367471-13527-3-git-send-email-yao at codesourcery dot com> <874n0jkokw dot fsf at fleche dot redhat dot com> <537EA293 dot 2050000 at codesourcery dot com>
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> On 05/22/2014 01:51 AM, Tom Tromey wrote:
Yao> +static void
Yao> +py_varobj_iter_dtor (struct varobj_iter *self)
Yao> +{
Yao> + struct py_varobj_iter *dis = (struct py_varobj_iter *) self;
Yao> +
Yao> + Py_XDECREF (dis->iter);
Tom> I think this has to acquire the GIL before calling Py_XDECREF.
Yao> PyGILState_Ensure and PyGILState_Release are added.
I think all transitions from gdb->python should use ensure_python_env.
That way the other things needed by gdb's python layer are guaranteed to
be set.
In this situation I think it could potentially cause a problem if
Py_XDECREF calls a user-written __del__ method somewhere.
thanks,
Tom