While I like boost::shared_ptr, it is not always possible to use it nicely.<div><br></div><div>In rviz I have plugin classes which are subclasses of QWidget (from Qt GUI library).  These objects are automatically deleted by Qt when their parent widgets are deleted.  I can be notified of their deletion by Qt, and call an "unload" or "decrement-reference-count" function, but it is not easy to use these QWidget pointers inside boost::shared_ptr without getting double-deletion crashes.</div>
<div><br></div><div>pluginlib::ClassLoader could have two interfaces, one which gives a shared_ptr and manages the reference count for the library itself, and another which gives a raw pointer and increments the ref count and also has a decrement-ref-count function.</div>
<div><br></div><div>Dave<br><br><div class="gmail_quote">On Mon, Feb 6, 2012 at 4:44 PM, Dirk Thomas <span dir="ltr"><<a href="mailto:dthomas@willowgarage.com">dthomas@willowgarage.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello all,<br>
<br>
attached is a draft specifying a minor enhancement to pluginlib which revises the load/create/unload life cycle of libraries.<br>
<br>
It enables automatic bookkeeping of created instance and automatically triggers unloading the library when the last instance goes out of scope.<br>
The proposal deprecates one existing method which can lead to difficult usage pattern (ranging from never unloading a library to unloading a library while it is still in use).<br>
<br>
The HTML version will be available soon:<br>
<a href="http://ros.org/reps/rep-0121.html" target="_blank">http://ros.org/reps/rep-0121.<u></u>html</a><br>
<br>
Please send comments, questions or feedback.<br>
Due to the small scope I am also asking for your vote (according to the guidelines stated at <a href="http://www.ros.org/reps/rep-0010.html" target="_blank">http://www.ros.org/reps/rep-<u></u>0010.html</a>).<br>
<br>
Best regards,<br>
Dirk<br>
<br>_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
<br></blockquote></div><br></div>