Re: [gtkmm] Glib critical messages on Property<>



On Fre, 2003-03-28 at 08:13, Andrew E. Makeev wrote:
> Daniel Elstner wrote:
> >
> >I reckon the problem might be an add_attribute() call with incompatible
> >types, and not directly caused by Glib::Property<> itself.  IIRC
> >Glib::Property<> has been used with success for custom types before; try
> >checking the list archives.
> >  
> >
> Yes, problem caused by Glib::Value<T*> (GValue, actualy).
> 
> 1. T* should be a pointer to class derived from GLib::Object.

No, it doesn't need to.

> 2. You should ensure you did proper initialization of your class propery 
> member in constructor.
> 3. And as Daniel said you have to watch you are using same T* pointers 
> when handling property value (using add_attribute or directly).
> 
> I think, it is better to use Glib::Property<void *> to store a pointer 
> to any custom class, casting functions gonna do dirk work for ya later. 
> At least, in my "FAST" text cellrenderer I have no troubles with such 
> things.

Uh no.  There's no reason to use C++ bindings if you gonna end up using
void* anyway.  The best thing to do is to use some smart pointer class,
otherwise memory management is going to become pretty hard.

Still, I think long* _should_ work.  There's pretty tricky Glib::Value<>
template code in place to allow things like that.  Frank: I'll probably
investigate your diff later today.

--Daniel





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