Re: [gtk-list] Re: Gtk programming style/advice
- From: Vandoorselaere Yoann <yoann coldserver com>
- To: gtk-list redhat com
- CC: amc50 eng cam ac uk
- Subject: Re: [gtk-list] Re: Gtk programming style/advice
- Date: Mon, 11 Oct 1999 11:29:15 +0200
Andy Connor wrote:
> Havoc Pennington wrote:
> >
> > What problems are you having? Are some widgets destroyed while you still
> > have pointers to them?
> >
>
> Not too sure what is going on as yet.
>
> I have a fairly complicated GUI, so rather than create all the widgets
> in one function, I want to split the creation into a number of functions
> - I know that some of the contents will change and this will make it
> easier for me to maintain.
>
> Essentially, I have a 3x3 table, each cell of which contains more
> widgets. One, for example, contains a scrolled window that contains a
> CTree. Another contains a set of toggle buttons, the state of which will
> effect the contents of the CTree.
>
> Everything works fine if I create all the widgets in one function.
>
> However, if I start to split it up and use a structure then it falls
> over almost straight away. Below is the start of the code, which seg
> faults when it tries to create the tree within the main window.
>
> Any comments appreciated.
>
> Andy
>
>
Don't you know that a pointer on a structure need to be alloced ?
int main(int argc, char *argv[]){
AllWidgets *everything;
+ everything = ( AllWidgets * ) malloc(sizeof(AllWidgets));
+ if ( everything == NULL ) {
+ perror("malloc");
+ exit(1);
+ }
gtk_init(&argc,&argv);
CreateMainWindow(everything);
CreateTable(everything);
gtk_main();
return 0;
}
--
-- Yoann, http://www.security-addict.org
It is well known that M$ products don't call free() after a
malloc().
The Unix community wish them good luck for their future
developments.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]