Re: Lost Pointer when adding GTK+ to an application



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 would suggest running valgrind.

You seem to have come to the firm conclusion that there is nothing wrong with
your pre-existing application. Several decades of experience has taught me that
things are not always as they seem, and while things do indeed appear to work,
perhaps even flawlessly, that, by itself, does not mean that you do not have a
hidden, perhaps subtle, coding error, which has laid undiscovered 'til now.

I'm not saying that this is the case here, just that you need to keep an open
mind until you do discover what the problem actually is.

Valgrind should be able to assist you in your search.

best rgds,

- -Greg

| 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?
|
| 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


- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
~                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   ghosler redhat com    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFIImqH404fl/0CV/QRAuruAJ9W/ULy2G5fOa0lXrG2tMVVGQbiRgCeM0gM
ijXLo7/9s5O8gpCk9cVVAeQ=
=vgLQ
-----END PGP SIGNATURE-----



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