notebook causes segmentation fault



Hello,
I'm new to the list and admittedly a novice to programming.
I'm trying to use "gtk_notebook_remove _page" or any other "notebook" function and am not understanding why my program keeps crashing with a segmentation fault.

I'm using GTK 2.4.3, Glade and Anjuta to build a simple app.
In Glade I create my main window and fill it with a generic notebook widget.
I put a button on the first page and a couple of labels on the second two pages.
I set my button to "clicked" and then save and build my code.

So far no problem, It configures and builds fine.
I then go into the callbacks file and find my "on_button1_clicked" function waiting
to be filled in.

If I just tell it to spit me out a message to the console every time it's clicked, the program works great. As soon as I try to access the notebook pointer and do some work with it, the program compiles fine, but seg faults as soon as I
click the button.

I've even traced this with the debugger.

here's the code from the callbacks.c file:

{
   GtkWidget *notebook1;
   gint = page;

   page=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook1));
   gtk_notebook_remove_page(GTK_NOTEBOOK(notebook1) , page);
}

I'm not changing anything else in any other file. I've also tried several other
"gtk_notebook_*" functions with the same results.

My original program, that I found the fault in, also accesses an about box
in another button on another page. This function performed perfectly.

What am I doing wrong?

Lee
ljohnson accessnet com




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