GTK-- error



In gtk-- example files all object are declared inside the Window class
definition, then they have the same time life that the Window itsef and
all goes right. But when I create a GTK object with local time life the
program crash in runtime. By example in a window constructor:

MainWnd::MainWnd(void)
  : Gtk_Window(GTK_WINDOW_TOPLEVEL)
{
  // This down´t work
  Gtk_Button install("Install");
}
	It compiles without errors, but breaks despite I don´t use the object
later. 
	If I write:

MainWnd::MainWnd(void)
  : Gtk_Window(GTK_WINDOW_TOPLEVEL)
{
  // This down´t work
  Gtk_Button install=new Gtk_Button("Install");
}
	Then this works fine. Of course, it works whenever I don´t delete the
object. In this case the programs crash again.
	Is this the desired behaviour?
	Related to this, another question: can I use a gtk-- object two times
in a window (by example a Separator in two places)? and in gtk+?
	Thanks.

-- 
+--------------------------+---------------------------+
|David Abilleira Freijeiro | mailto:odaf@nexo.es       |
+--------------------------+---------------------------+
|http://www.geocities.com/SiliconValley/Bay/1040/      |
|    (UNED, Mis Programas, Linux, Programación, etc.)  |
+------------------------------------------------------+



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