Opened 14 years ago

Last modified 10 years ago

#2179 new Bugs

add support for weak_ptr

Reported by: pwinston@… Owned by: Dave Abrahams
Milestone: Boost 1.36.0 Component: python USE GITHUB
Version: Boost 1.35.0 Severity: Problem
Keywords: Cc:

Description

Today shared_ptr works very well, but it makes it difficult for the C++ application to retain control over the lifetime of its objects. Variables in the interpreter which are hard to clear can prevent an object from being deleting.

weak_ptr support would be the ideal solution. A application could hand out only weak_ptrs to Python. The object could then be deleted as normal.

Attempting to use a weak_ptr in Python if the object has been released should throw. Python code which knows its objects might be deleted out from under it can catch this exception.

See thread w/ Dave Abrahams titled "application exit and shared_ptr" in C++-sig.

Change History (2)

comment:1 by Dave Abrahams, 13 years ago

I'd like to have a (currently-failing) test case that demonstrates what you want to work. Without that, I can't be sure you're getting what you really want.

Note: See TracTickets for help on using tickets.