[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Segmentation fault in gtk2-perl-application
- From: muppet <scott asofyet org>
- To: Stephan Brunner <stephan brunner gmx de>
- Cc: gtk-perl-list gnome org
- Subject: Re: Segmentation fault in gtk2-perl-application
- Date: Fri, 1 Apr 2005 18:45:33 -0500
On Apr 1, 2005, at 5:39 PM, Stephan Brunner wrote:
Yes, this script also segfaults. The backtrace is pretty much the same
as
before, I think line #7 changed a bit (missing my_perl = ...).
alright, then, try the attached C program.
/*
C port of crashing perl example.
gcc -o stephan-crash stephan-crash.c -W -g `pkg-config --cflags --libs gtk+-2.0`
*/
#include <gtk/gtk.h>
void
load_dir ()
{
GtkWidget * dlg;
GtkResponseType response;
g_print ("Entering sub loadDir...\n");
dlg = gtk_file_chooser_dialog_new
("Select directory", NULL,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
response = gtk_dialog_run (GTK_DIALOG (dlg));
if (response == GTK_RESPONSE_OK) {
gchar * filename =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg));
g_print ("You selected: >%s<\n", filename);
g_free (filename);
} else {
g_print ("You aborted.\n");
}
gtk_widget_destroy (dlg);
g_print ("Leaving sub loadDir...\n");
}
int
main (int argc,
char *argv[])
{
GtkWidget * window;
GtkWidget * button;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
button = gtk_button_new_with_label ("click me");
g_signal_connect (button, "clicked", G_CALLBACK (load_dir), NULL);
gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
if *that* still causes a crash (it doesn't for me), then file a bug in
gtk+'s bugzilla and attach the program.
Seeing this, it seems to me that the segfault depends not on directory
names
or contents, but more on the relation of working directory and the
selected
directory -- although I understand that this is pretty vague and merely
impossible to extract hard facts or infos from.
that makes it sound like something is wrong with GtkFileChooser.
the valgrind output confirms that there's memory corruption,
specifically, using freed memory on the heap. the fun part will be
tracking down where and why that actually occurs...
Puh, the thing is that I'm simply lacking any of the needed knowledge
for this
"fun part". Is this at all possible for you as you can't reproduce the
segfault? Or, what can I learn and do to get it done?
valgrind usually tells you something along the lines of "invalid access
to this memory, which was freed here" with two backtraces. you go into
each one and poke around to see if freeing the object is the correct
thing to do there. it nearly always depends on what the actual code
is.
--
elysse (in labor): is the head the biggest part?
midwife: yes.
elysse: oh, good.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]