Re: [introspection] struct without copy constructor



Le Tue, 31 Jan 2012 16:58:37 +0100,
Steve Frécinaux <nudrema gmail com> a écrit :

> You should rather return the object itself (same for the refcount case). 
> Glib doesn't have to know what you return is actually the same instance 
> as before.

I tryed with the object himself but, I got a double free error, at the end.
the binding do not check that object are identical (save adress) and
try to free it two times. Is it a bug ?


> This is not black magic, this is just telling glib how to manage your 
> objects as there is no way in C to duplicate a random struct or free it 
> (you can have pointers, etc).
> 
> Static and refcounted structs are just special cases of copy/free where 
> the copy is the object itself and you don't need to do anything to free 
> the resources.

Yes but in my case the object is not static :), it was allocated by a _new method.


thanks


Frederic

-- 
GPG public key 4096R/4696E015 2011-02-14
    fingerprint = E92E 7E6E 9E9D A6B1 AA31  39DC 5632 906F 4696 E015
uid  Picca Frédéric-Emmanuel <picca synchrotron-soleil fr>

GPG public key 1024D/A59B1171 2009-08-11
    fingerprint = 1688 A3D6 F0BD E4DF 2E6B  06AA B6A9 BA6A A59B 1171
uid  Picca Frédéric-Emmanuel <picca debian org>

Attachment: signature.asc
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]