I have an issue where I am using SWIG to generate a director that uses a C++ std::shared_ptr. That object is then registered into a boost::signal (on the C++ native side) which uses weak pointer references and converts those to strong references on firing of the signal to each slot. The problem I have run across is a) the boost::signal adds a strong reference to the shared_ptr but has not fired the signal on the Java object b) The java object is garbage collected and the C++ shared pointer is released c) the boost::signal invokes the signal on the slot using the shared_ptr it has added a strong reference to but the Java side finalize() method has completed rendering the Java object invalid d) this results in a Java exception for a null object.
My question is, are there any recommended best practices, generation options to deal with this issue? I have looked through the mailing lists and found a few references indicating the two object life cycles need to stay in sync which I understand.
Robert Breckner Senior Software Engineer PC-Doctor, Inc. 10345 Professional Circle, Suite 183 Reno, NV 89521 (775) 336-4053 [hidden email]
The information contained in this message is confidential. It is intended to be read only by the individual or entity to whom it is addressed or by an authorized designee. If the reader of this message is not the intended recipient, be aware that distribution of this message in any form is strictly prohibited. If you have received this message in error, please immediately notify the sender and destroy any copy of this message.