a warning about glib

I just wrote an email to the gtk-devel-list with an update on the potentially-dangerous work that has gone into GLib since the Boston Summit (where we planned quite a lot of changes).

One item in particular needs to be mentioned.

A few moments ago I just landed a relatively small patch that refuses attempts to add an interface to a class that has already been initialised (which usually occurs at first instantiation), emitting a g_warning() instead.

This functionality was used in a dirty way by pygobject until earlier today when Martin landed a rewritten version of the code. libsoup also made theoretical use of this feature, although it’s unclear if the code in question was ever executed in the real world (and is certainly never used by any module in jhbuild).

The new warning looks something like this:

(process:30660): GLib-GObject-WARNING **: attempting to add an interface (TestIface1) to class (BaseObject) after class_init

The main upshot of this is that if you are building glib in jhbuild and you fail to also build the new pygobject then you may encounter problems. If you are making packages for a distribution then you should also take care to make sure that you manage the upgrades to glib and pygobject in lock-step.

The patch was written in a way that is intentionally minimal and easy to back out. At this point we’re playing wait-and-see to find out if other modules are broken by this change. If you spot any other instances of this warning in the wild (apart from those mentioned above), please let me know.

3 thoughts on “a warning about glib”

    1. There are no plans to do a GLib 3 (or 4) in the short term. Take the level of pain caused by the gtk2->gtk3 transition (which is still not completely done yet) and multiply it by about 10 to get an idea of what a GLib transition would feel like…

  1. For the record, you do not need to update glib and pygobject in lockstep; the pygobject change will work fine on older glibs, just not the other way around: i. e. you cannot run glib >= 2.35.2 with pygobject < 3.7.2 (neither are released yet).

Comments are closed.