On Jul 16, 2009, at 16:00, Thiago Arrais wrote:

> On Wed, Jul 15, 2009 at 5:21 PM, Axel Simon<axel.si...@ens.fr> wrote:
>> ). Could you revert your changes to accelGroupNew and change, in
>> glib/.../GObject.chs.pp
>>
>> constructNewGObject constr generator = do
>>  objPtr <- generator
>>  obj <- newForeignPtr objPtr objectUnref
>>  return $! constr obj
>>
>> to
>>
>> constructNewGObject constr generator = do
>>  objPtr <- generator
>>  objectRefSink objPtr
>>  obj <- newForeignPtr objPtr objectUnref
>>  return $! constr obj
>
> That worked too. A new patch is available at
> http://thiagoarrais.com/repos/gtk2hs-upstream/ (I've unpulled the old
> one, so it should be safe to pull).
>
> I've added preprocessor directives to your suggested code, since
> objectRefSink is only available when glib >= 2.10.0. I am not sure
> what to do when 2.10 isn't available (should the reference counter be
> incremented to account for the Haskell pointer or should nothing be
> done?). I am downloading Debian Sarge right now to figure that out.


You can install older version of Glib, Atk, Pango and Gtk from source  
in a different directory and change PKG_CONFIG_PATH accordingly.

I would guess that earlier versions who didn't have the floating  
reference did have a reference count of one. Which must mean that  
this floating reference is meant to fix some space leaks where people  
create an object, pass it to some other object and then don't call  
object_unref.

Axel.


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to