On Wed, 2008-05-07 at 20:33 -0600, Diego Rivera wrote: > Hi! I am not exactly new to GTK+, however I have come across a problem i > have no explanation for, and I'll be glad if someone could point me towards > a possible solution. > > I am currently developing an application that uses various algorithms for > sequence alignment in biological applications (DNA, RNA, Proteins and so > on). This application is mainly for scientific purposes. > > The core algorithms are already running fine as a console application in a > very stable version. I am working in adding some graphical interface to the > program using GTK+. So, I built a little Window that asks for the different > parameters and makes a call to the already defined functions in the console > application, which are indeed stable. However, when making the call to the > algorithm with GTK+ running, some of the pointers in my data structures get > lost, and I just get a Segmentation Fault. > > While trying to debug this weird behavior, I have narrowed the problem to > the fact of having a window running. > > Right now, I just have a main that creates a GtkWindow with a GtkButton, and > the callback of the button calls the stable routine of the console > application using some "hard-wired" parameters. I have made tests and the > console application gives the correct answer for those parameters. However, > when calling the routine from the callback, Segmentation Fault is the only > result I have been able to get. > > I have tried with different versions of GTK+ and the outcome is persistent. > > The data structure of the console application looks something like this: > > typedef struct{ > int length; > char* seq; > }sequence_t; > > typedef struct{ > int n; > int m; > int** table; > }table_t; > > typedef struct{ > sequence_t* vp; > sequence_t* wp; > table_t* table; > int scoring; > int result; > }alignment_t; > > Using gdb i have found that the Segmentation Fault occurs at some point when > accesing the table from the alignment. > > I believe i have made no memory errors in my console application, since it > runs ok every time. However, i haven't seen the correct output from my GTK > application. > > Is there any hint that you could give me in order to correct the error? > How did you add the GTK component to the existing console app; are they one process or two?
Your segfault suggest that they are two separate processes. In which case attempting to share memory elements will cause a segfault every time no matter how correct and hard-coded the structures. You may need to consider designing in and using some type of IPC (Inter-Process Communications) like a named-pipe, shared-memory, socket communications, memory queue, etc. Something designed to communicate between two active processes. James, > Thanks > - Diego Rivera - > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list