Re: Faling to wrap object in signal handler



2012-03-04 18:45, A J Delaney brighton ac uk skrev:
Dear all,
	I've been extending the clutter-box2dmm bindings and have run into
another issue.  I have exposed the signal_collision so that you can now
tell if two Box2DChild objects have collided.  It is also necessary to
expose Box2DCollision, which I have done.

I can now connect up the callback on a child
b2dchild->signal_collision().connect(sigc::ptr_fun(&handle_collision));

To call a function such as,
static void
handle_collision(const Glib::RefPtr<Clutter::Box2D::Box2DCollision>&  c)
{ ... }

In the mainline I can create() objects of type
Glib::RefPtr<Clutter::Box2D::Box2DCollision>.  However, any time I enter
the signal handler I get a
"glibmm-WARNING **: Failed to wrap object of type
'ClutterBox2DCollision'. Hint: this error is commonly caused by failing
to call a library init() function."

and the signal handler is defined (by gmmproc) as
Glib::SignalProxy1<  void,const
Glib::RefPtr<Clutter::Box2D::Box2DCollision>  &  >
Box2DChild::signal_collision()

static const Glib::SignalProxyInfo Box2DChild_signal_collision_info =
{
   "collision",
   (GCallback)&Box2DChild_signal_collision_callback,
   (GCallback)&Box2DChild_signal_collision_callback
};

There is also a gmmproc provided
Glib::RefPtr<Clutter::Box2D::Box2DCollision>  wrap(ClutterBox2DCollision*
object, bool take_copy)

And Box2DChild_signal_collision_callback has signature
static void Box2DChild_signal_collision_callback(ClutterBox2DChild*
self, ClutterBox2DCollision* p0,void* data)

Have I forgotten to override some other wrapper method for
ClutterBox2DCollision * to a RefPtr for Clutter::Box2D::Box2DCollision?


It's possible that the wrap_init() function, generated by generate_wrap_init.pl, does not correctly register Clutter::Box2D::Box2DCollision_Class::wrap_new(). Possible reasons:

1. generate_wrap_init.pl has not been told to read the .hg file where Clutter::Box2D::Box2DCollision is defined.

2. No _GMMPROC_EXTRA_NAMESPACE(Box2D) in the .hg file.
generate_wrap_init.pl ignores namespace declarations. It gets the name of the main namespace (Clutter in your case) from a command argument. If there are sub-namespaces (Box2D in your case) they must be given in a _GMMPROC_EXTRA_NAMESPACE macro that generate_wrap_init.pl does read. See the Gio::DBus files, e.g.
http://git.gnome.org/browse/glibmm/tree/gio/src/dbusconnection.hg

3. Both Clutter::Box2D::Box2DCollision and Clutter::Box2DCollision exist (or Clutter::xxx::Box2DCollision where xxx is any namespace name other than Box2D), and you use a version of generate_wrap_init.pl where bug 640029 has not been fixed. It was fixed very recently, 2012-02-28 in git.

Kjell


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