Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 292 by jeremiah...@gmail.com: In python-proto2.cc any time ->parent is set you need to Py_INCREF on it
http://code.google.com/p/protobuf/issues/detail?id=292

What steps will reproduce the problem?
1. Get a python object referencing a sub protobuf object of some parent
2. Let the parent go out of scope and be free'd
3. Access data from the sub object, and it has already been free'd

What is the expected output? What do you see instead?
Getting the data from the child object.  Instead got a segfault

What version of the product are you using? On what operating system?
2.4.0a/2.4.1

Please provide any additional information below.
When ->parent is set, or really when free_message is set false, the parent cmessage object needs to have its python reference count incremented so it won't be garbage collected while a child is still around referencing its internals. Then decremented when the child is free'd.

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to