I've run into an issue while playing around with goocanvasmm trying to
implement custom items and I'm wondering if anybody has run into this
before. The issue is as follows:
- To create a 'group' item, you need to implement the add_child virtual
function
- within the add_child virtual function, it appears that you are
supposed to call set_parent on the new child and set its parent to
yourself. In other words, something like:
add_child_vfunc(Glib::RefPtr<Item> child, int position) {
// add child to an array of items
child->set_parent(this);
}
The problem is, the set_parent() function takes a Glib::RefPtr<>, so I
would need to do something like
child->set_parent(Glib::RefPtr<Item>(this));
Except this seems to cause refcounting problems and the program crashes.