Re: Casting from a wrapped class to a possible implemented interface
- From: Murray Cumming <murrayc murrayc com>
- To: José Alburquerque <jaalburquerque cox net>
- Cc: gtkmm-list gnome org
- Subject: Re: Casting from a wrapped class to a possible implemented interface
- Date: Tue, 04 Mar 2008 14:10:23 +0100
On Mon, 2008-03-03 at 20:19 -0500, José Alburquerque wrote:
> José Alburquerque wrote:
> > My concern, however, is that because the newly created
> > Gst::ElementInterfaced class is not "wrapped", it doesn't look like it
> > will be destroyed when all references to the underlying gobject are
> > gone.
>
> I believe I found a solution to this using g_object_weak_ref
> <http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-weak-ref>
> <http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GWeakNotify>
> to notify the unwrapped instance when the gobject is destroyed.
Yes, this seems worth a try. Glib::ObjectBase normally does this by
waiting for a callback that is set when setting GObject data, but this
should work too, and seems more obvious.
> This
> may enable casting from elements to interfaces that the underlying C
> object implements. Thoughts?
It's an interesting approach. It seems sensible. I'd be interested to
see it in action.
Well done.
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]