gnash-commit
[Top][All Lists]
Advanced

[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


From: Benjamin Wolsey
Subject: 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.]
Date: 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
ownership better.

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
other...

It's great that it's all working now, anyway!

--
Free Flash, use Gnash
http://www.gnu.org/software/gnash/

Benjamin Wolsey, Software Developer - http://benjaminwolsey.de

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]