Gtk+/GObject memory management, continued

I've changed the way the memory is managed in cl-gtk2. With this I've solved several issues:

  • Upcasting objects to known superclasses. When we pass the reference to an instance of some custom class (that is not known to GObject/Gtk+) into Gtk+, we expect that the reference that we get back from it would also point to the instance of that same class. In some cases, we would instead get a reference to its superclass.
  • Some edge cases in reference counting. In some cases, an object had its ref count increased mistakenly which caused leaks of said objects.
  • The instantiation of classes defined in Lisp and inheriting from GObject classes happened differently from the instantiation of the classes defined in Gtk+.
  • Some of the Gtk+ functions return a pointer to an object with their ref count already incremented which caused memory leaks. For example, gdk_gc_new and gtk_widget_create_pango_layout.

Still, one confusing issue remains related to the GtkBuilder. I don't get why it happens, but the objects created with GtkBilder have extra references which cause memory leaks. But I hope to deal with this issue separately.