While I like boost::shared_ptr, it is not always possible to use it nicely.

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.

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.

Dave

On Mon, Feb 6, 2012 at 4:44 PM, Dirk Thomas <dthomas@willowgarage.com> wrote:
Hello all,

attached is a draft specifying a minor enhancement to pluginlib which revises the load/create/unload life cycle of libraries.

It enables automatic bookkeeping of created instance and automatically triggers unloading the library when the last instance goes out of scope.
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).

The HTML version will be available soon:
http://ros.org/reps/rep-0121.html

Please send comments, questions or feedback.
Due to the small scope I am also asking for your vote (according to the guidelines stated at http://www.ros.org/reps/rep-0010.html).

Best regards,
Dirk

_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users