Re: [gtkmm] how to use Glib::Object



On 20 Dec 2002 23:26:14 +0100
Daniel Elstner <daniel elstner gmx net> wrote:

> On Fre, 2002-12-20 at 22:52, triendl klaus wrote:
> > hi,
> > 
> > i have a class derived from Glib::Object to enable reference counting in order to use it with Glib::RefPtr.
> > 
> > the following warning appears everytime i create a Glib::RefPtr<MyObject>:
> > glibmm-WARNING **: Object::Object(): Did you really mean to call this?
> > 
> > is it bad practice to use the standard ctor and how to use the other ctors?
> 
> You are not supposed to derive from Glib::Object at all, unless you want
> to implement a wrapper for a C interface based on GObject.

this should be clearly said in the docu.


> There are plenty of smart pointer implementations around you could use,
> for instance boost::shared_ptr<>.  If you fear the idea of adding yet
> another dependency to your application then implement one yourself (it's
> quite simple actually) or just copy'n'paste existing code.

if i figured it out right then the debian package libboost-dev doesn't depend on a runtime library and thus a binary package wouldn't depend on the boost lib. this makes it interesting.
for now i wrote a refptr myself.


> You could have a look at Util::SharedPtr<> in my app regexxer if you

nevertheless could you let me have a look at your Util?



--
triendl klaus



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