Fix reference counting for GObjects. This bug is only present in Glib libraries >2.10 which introduced floating references. The problem is that even GObjects have always a floating reference which has to be turned into a permanent reference. So far, we omitted this call which had the effect that we would keep the object around with a floating reference. Some objects in Gtk will call ref_sink on an object that is passed to them, rather than ref. This causes the floating reference to be turned into a proper one, rather than adding a new reference. Thus, when the Haskell GC comes along, the object is unref'd and destroyed while it's still being held in the Gtk object. This patch always ref_sinks the object, resulting in a proper refence being held by Haskell and forcing every ref_sink in Gtk code to have the semantics of ref.
Fix reference counting for GObjects.
This bug is only present in Glib libraries >2.10 which introduced floating
references. The problem is that even GObjects have always a floating
reference which has to be turned into a permanent reference. So far,
we omitted this call which had the effect that we would keep the object
around with a floating reference. Some objects in Gtk will call ref_sink
on an object that is passed to them, rather than ref. This causes the
floating reference to be turned into a proper one, rather than adding a new
reference. Thus, when the Haskell GC comes along, the object is unref'd and
destroyed while it's still being held in the Gtk object. This patch always
ref_sinks the object, resulting in a proper refence being held by Haskell
and forcing every ref_sink in Gtk code to have the semantics of ref.

vincenthz/webkit