Re: [gtk-list] gtk--: bug with widget instantiation?




On Thu, 3 Sep 1998, Christof Petig wrote:
> here's a really strange bug:
> using the following statements (window1.cc:14) I get an SIGSEGV:
> 
> vector <Gtk_MenuItem>  optionmenu1_menuitems;
> 

The bug is that the copy constructor should be private. There's no way you
should be able to do this. It's *incredibly* inefficient - that's a large
object you're copying. With much hassle and Gtk changes it could maybe be
made to work but you don't want to do it. You are probably getting a
segfault because the default copy constructor is just copying all the
internal pointers from one object to the other, and then one of the
objects (thinking it's the only object using the pointer) deletes one of
the pointers. Probably when the temporary's destructor is called if
nothing else. 

There's no way to write C++ without pointers, especially with Gtk
underneath. If you don't want to use them and don't care much about
efficiency, you should probably choose a higher level language like Guile,
Perl, etc. 

Havoc





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