[Glade-users] Segmentation fault



Hi, all.

There is a little problem with my program. I'm new to Gtk\Gnome
developing. My first program had widgets declared and painted in main.
But now I wrote a program, that have multiple functions with widgets
declarations, and it compiled ok too, but it segfaults every time I
click anywhere on window... I've posted the same on gtk-app-devel, but
there was no reply.
Here is a sample of my app:
-------------------------------------------code------------------------------------------------------
#include <gtk/gtk.h>



//closing splash
static void 
close_splash(GtkButton *button, gpointer data)
{
        gtk_widget_destroy(data);
}



static void 
make_splash()
{
        
        
        //splash
  GtkWidget *splash_window;
  GtkWidget *hbox1_s;
  GtkWidget *image1_s;
  GtkWidget *vbox1_s;
  GtkWidget *image2_s;
  GtkWidget *label1_s;
  GtkWidget *hbox2_s;
  GtkWidget *fixed1_s;
  GtkWidget *button1_s;



   splash_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title (GTK_WINDOW (splash_window),"test_app_1");
   gtk_window_set_resizable (GTK_WINDOW (splash_window), FALSE);
                
        hbox1_s = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1_s);
  gtk_container_add (GTK_CONTAINER (splash_window), hbox1_s);
        
    image1_s = gtk_image_new_from_file ("../installdata/bar.gif");
  gtk_widget_show (image1_s);
  gtk_box_pack_start (GTK_BOX (hbox1_s), image1_s, TRUE, TRUE, 0);
  gtk_widget_set_size_request (image1_s, 150, 500);
  gtk_misc_set_alignment (GTK_MISC (image1_s), 0, 0);   
        
  vbox1_s = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1_s);
  gtk_box_pack_start (GTK_BOX (hbox1_s), vbox1_s, TRUE, TRUE, 0);

  image2_s = gtk_image_new_from_file( "../installdata/logo.gif");
  gtk_box_pack_start (GTK_BOX (vbox1_s), image2_s, FALSE, FALSE, 0);
  gtk_widget_set_size_request (image2_s, 400, 100);
  gtk_misc_set_alignment (GTK_MISC (image2_s), 0, 0);
 
  label1_s = gtk_label_new ("Test Label.");
  gtk_box_pack_start (GTK_BOX (vbox1_s), label1_s, TRUE, TRUE, 0);
  gtk_widget_set_size_request (label1_s, 400, 56);
  gtk_label_set_justify (GTK_LABEL (label1_s), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label1_s), 0.05, 0.5);

  hbox2_s = gtk_hbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox1_s), hbox2_s, FALSE, TRUE, 0);

  fixed1_s = gtk_fixed_new ();
  gtk_box_pack_start (GTK_BOX (hbox2_s), fixed1_s, TRUE, TRUE, 0);

  button1_s = gtk_button_new_with_mnemonic ("Next");
  gtk_box_pack_start (GTK_BOX (hbox2_s), button1_s, FALSE, FALSE, 0);
  gtk_widget_set_size_request (button1_s, 82, 31);
        
  g_signal_connect(GTK_OBJECT (button1_s), "clicked",
                                G_CALLBACK(close_splash),
                                GTK_OBJECT (splash_window)); 

 
        
        
        
gtk_widget_show(splash_window);
gtk_widget_show(hbox1_s);
gtk_widget_show(image1_s);
gtk_widget_show(vbox1_s);
gtk_widget_show(image2_s);
gtk_widget_show(label1_s);
gtk_widget_show(hbox2_s);
gtk_widget_show(fixed1_s);
gtk_widget_show(button1_s);


}

int 
main( int   argc,
          char *argv[] )
{
gtk_init(&argc,&argv);
        
make_splash();  
        
gtk_main();
 
    return 0;
}






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