Re: Re:



On Fri, 2011-01-28 at 08:18 -0300, Culpian Camilo Martin wrote:
> El vie, 28-01-2011 a las 10:13 +0100, Murray Cumming escribió:
> > On Fri, 2011-01-28 at 10:07 +0100, Chris Kühl wrote:
> > > On Fri, Jan 28, 2011 at 5:37 AM, Culpian Camilo Martin
> > > <camiloculpian gmail com> wrote:
> > > > Hi, I'd like to create my own Gobject in C++, I have to inherit from
> > > > Glib::ObjectBase or Glib::Object?, where can i find some good
> > > > documentation?
> > 
> > The answer really depends on what you actually want to achieve.
> > 
> What i want to do is to crate objects that can use Glib::RefPtr, (not
> necesary widgets), like
> 
> class foo : public (Glib::Object or ObjectBase)
> {
> 	static Glib::RefPtr<foo> create
> 	(
> 		return Glib::RefPtr<foo>(new foo());
> 	);
> 	foo();
> 	~foo();
> }

That's not a particularly good idea. If you want reference-counting then
try using a non-intrusive reference-counting shared pointer, for
instance from boost.

Or make your own, like I do in Glom:
http://git.gnome.org/browse/glom/tree/glom/libglom/sharedptr.h

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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