Re: More wrapping fun
- From: "Paul Davis" <pjdavis engineering uiowa edu>
- To: "GTKmm List" <gtkmm-list gnome org>
- Subject: Re: More wrapping fun
- Date: Mon, 2 Oct 2006 20:52:14 -0500
Howdy,
I've managed to narrow down this problem. And I'm at a loss for words.
Basically, after the model gets set on a view, the view gets notified when any Item is created in the model so that the View can emit an item_view_created signal.
Guess what. It looks like when the signal gets emitted, it finishes instantiating the object for the cast in the signal handler. So, by the time that things return to my constructor in the call to create(), the object has been fully instantiated.
Now. The question is, how do I make things work despite this?
I've been thinking about removing the GObject* constructor from the ItemSimple (the base class) and instead making the wrap method call goo_item_"x"_new, and returning a Glib::RefPtr that wraps the return of new.
Ie:
Chage this:
Rect::Rect(const Glib::RefPtr<Item>& parent, gdouble x, gdouble y, gdouble width, gdouble height )
:
ItemSimple( G_OBJECT( goo_canvas_rect_new( parent->gobj(), x, y, width, height, NULL ) ) )
{
}
To this:
Rect::Rect(const Glib::RefPtr<Item>& parent, gdouble x, gdouble y, gdouble width, gdouble height )
{
return Glib::wrap( G_OBJECT( goo_canvas_rect_new( parent->gobj(), x, y, width, height, NULL ) ) ), true ) ;
}
I haven't tried it yet, but if it works, I'm going to run with it. Unless someone can slap me on the head and yell shenanigans that is...
Paul
On 10/2/06,
Paul Davis <pjdavis engineering uiowa edu> wrote:
Hey,
Has anyone ever seen this error?
(moving_shapes:28509): glibmm-WARNING **: This object, of type GooCanvasPolyline, already has a wrapper.
You should use wrap() instead of a constructor.
A specific example is the moving_shapes example in libgoocanvasmm. If a call is made to create an object after this call:
_view->set_model( model )
It gives me the error above.
I looked at objectbase.c in glibmm. It appears as though the pointer already has a stored Glib::qdata_ when the call to instantiate Glib::Object( gobj ) is called in any of the
GooCanvas::(Item Derivied, ie Rect)::create( ... ) calls.
I'm not sure I even know where to begin looking for this one, so any pointers would be helpful.
Paul
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]