aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-infthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-infthread.c')
-rw-r--r--gdb/python/py-infthread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index e15e281..bf90d08 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -41,12 +41,16 @@ create_thread_object (struct thread_info *tp)
{
thread_object *thread_obj;
+ gdbpy_ref<inferior_object> inf_obj = inferior_to_inferior_object (tp->inf);
+ if (inf_obj == NULL)
+ return NULL;
+
thread_obj = PyObject_New (thread_object, &thread_object_type);
if (!thread_obj)
return NULL;
thread_obj->thread = tp;
- thread_obj->inf_obj = (PyObject *) inferior_to_inferior_object (tp->inf);
+ thread_obj->inf_obj = (PyObject *) inf_obj.release ();
return thread_obj;
}