Shared Buttons causing seg fault?
- From: Brooklyn Linux Solutions <ruben mrbrklyn com>
- To: gtk-app-devel-list gnome org
- Cc: gtk-app-devel-list gnome org
- Subject: Shared Buttons causing seg fault?
- Date: Thu, 17 May 2001 16:58:51 -0400
Does anyone know why this causes a segmentation fault. I think it has to
do with the pointer magic gtk is doing with GTKWIDGETs like block.
When I remove the the gtk_signal_connect function attached to the button.
Ruben
_________________________________________________________________
#include <stdio.h>
#include <gtk/gtk.h>
GtkWidget *PackNewButton(GtkWidget *box, char * szlable){
GtkWidget *button = gtk_button_new_with_label(szlable);
gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
gtk_widget_show(button);
return(button);
}
gint goaway(GtkWidget * widget, gpointer data){
printf ("You Rang?\n");
return(FALSE);
}
gint Delete(GtkWidget * widget, gpointer data){
gtk_main_quit();
return(FALSE);
}
int main(int argc, char *argv[]){
GtkWidget *window, *button, *box;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Verticle Packing Box");
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(Delete), NULL);
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(goaway), NULL);
gtk_container_border_width(GTK_CONTAINER(window), 50);
box = gtk_vbox_new(FALSE,0);
button = PackNewButton(box, "Button");
button = PackNewButton(box, "Button1");
button = PackNewButton(box, "Button2");
button = PackNewButton(box, "Button3");
button = PackNewButton(box, "Button4");
button = PackNewButton(box, "Button5");
gtk_container_add(GTK_CONTAINER(window), box);
gtk_widget_show(box);
gtk_widget_show(window);
gtk_main();
exit(0);
}
--
Brooklyn Linux Solutions
http://www.mrbrklyn.com
http://www.brooklynonline.com
1-718-382-5752
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]