[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fwd: Re: [Gnash-commit] /srv/bzr/gnash/trunk r10819: add Tomeu Vizo
Re: [Fwd: Re: [Gnash-commit] /srv/bzr/gnash/trunk r10819: add Tomeu Vizoso's patch to make Gnash be a gtk widget and python module.]
Fri, 24 Apr 2009 14:44:33 +0200
> > Storing auto_ptrs as public members of a struct seems to be inviting
> > disaster, as copying them will set the original pointer to null. If the
> > struct isn't designed to be copied, it should be non-copyable, or the
> > default cctor will reset all the std::auto_ptr members in the original.
> I'm quite ignorant of C++, what type of references would you use
> there? All those members are private and owned by GnashCanvas.
In C++ they are public members, as there's no private access specifier.
"Private" in GTK presumably means either you can access it but
shouldn't, or that it's hidden in an implementation file (which seems to
be the case here).
> > And preferably the auto_ptrs should be private members with accessors.
> This isn't a C++ class but a struct containing the private stuff of a
> Gtk widget.
The issue is what can be done with the struct from other code that uses
it. The worst problem arises if an object of this type is ever copied,
as the original object then becomes invalid. Probably GTK won't try to
copy it, but if it's possible to make the object noncopyable without
breaking the GTK interface, it would prevent that from happening. In any
case, I'd suggest using boost::scoped_ptr instead of std::auto_ptr, as
it will also prevent any kind of unwanted copying and signifies
I realize this is a mixture of C and C++ to integrate with GTK and so
isn't ever going to look great in either language, though it's an
interesting question how far it should be pushed towards one or the
It's great that it's all working now, anyway!
Free Flash, use Gnash
Benjamin Wolsey, Software Developer - http://benjaminwolsey.de
Description: Dies ist ein digital signierter Nachrichtenteil