Gtk::TextTagTable signals have incorrect type for tag
The signals in Gtk::TextTagTable take handlers with parameter type Glib::RefPtrGtk::TextTag. This suggests a shared ownership of tag, which is not true. Scenario:
- Create new tag using your own tag class deriving from Gtk::TextTag (variable of type Glib::RefPtr)
- call add() on Gtk::TextTagTable passing that tag
- signal_tag_added() fires, a handler attached to it receives the same tag in the form of Glib::RefPtrGtk::TextTag which inside the handler can be safely casted to Glib::RefPtr; save the tag in some list
- the function that called add() exits, original tag variable goes out of scope and the dynamically allocated MyTextTag is destroyed
- the list to which Glib::RefPtrGtk::TextTag from signal handler was added now contains a Glib::RefPtr<> that inside itself contains a dangling pointer; the GtkTextTag still exists inside tag table, but the C++ of derived class is gone with anything useful in contained
One way of fixing it is for signal handler to receive Gtk::TextTag instead of RefPtr to it. Other one is to make sure the RefPtr received by signal is the same one that was passed to add() method, so that ownership is shared.