Re: Abend in gdk_pixbuf_new_from_file
- From: Bryan Brown <bbrown saltmine radix net>
- To: gtk-app-devel-list gnome org
- Subject: Re: Abend in gdk_pixbuf_new_from_file
- Date: Fri, 27 Feb 2004 08:09:34 -0500 (EST)
On 26 Feb 2004, Iago Rubio wrote:
[snip]
It really looks like you're passing a NULL or freed pointer anywhere.
Are you sure filename_local is not NULL when you pass it to
gdk_pixbuf_new_from_file () ?
OK, I re-ran the application with the debugger and displayed the contents
of the file name string being passes to gdk_pixbuf_new_from_file. Here's
the relevant code:
=== begin included code snippet ===
gchar *filename;
gchar *filename_test;
GtkWidget *file_selector;
[snip]
void
on_read_ok_button_clicked (GtkButton *button,
gpointer user_data)
{
GdkPixbuf *pixbuf = NULL;
GError *error;
[snip]
filename = (gchar *) gtk_file_selection_get_filename (
GTK_FILE_SELECTION (file_selector));
filename_test = g_strdup (filename);
gtk_widget_destroy (file_selector);
pixbuf = gdk_pixbuf_new_from_file (filename_test,
&error);
[snip]
=== end included code snippet ===
I changed the local variable "filename_local" to the global variable
"filename_test" because gdb was reporting that it couldn't find a variable
"filename_local" to print. [sigh]
Anyway, here are the contents of the debugger command file:
=== begin gdb commands ===
break on_read_ok_button_clicked
run
c
print filename
print filename_test
bt
quit
y
=== end gdb commands ===
Since I'm not sure how much of the debugger output is relevant, I've
included it all. Note that the contents of "filename" and "filename_test"
are not NULL, and indeed both point to a valid text string.
=== begin debugger output ===
Breakpoint 1 at 0x804ef1c: file callbacks.c, line 229.
[New Thread 1086104992 (LWP 12163)]
[Switching to Thread 1086104992 (LWP 12163)]
Breakpoint 1, on_read_ok_button_clicked (button=0x81807b8, user_data=0x0)
at callbacks.c:229
229 filename = (gchar *) gtk_file_selection_get_filename
(GTK_FILE_SELECTION (file_selector));
Program received signal SIGSEGV, Segmentation fault.
0x4207a42b in strlen () from /lib/tls/libc.so.6
$1 = (gchar *) 0x404f8380 "/home/bbrown/Projects/xxxxxxx/src/zzz_master.png"
$2 = (gchar *) 0x81c5e78 "/home/bbrown/Projects/xxxxxxx/src/zzz_master.png"
#0 0x4207a42b in strlen () from /lib/tls/libc.so.6
#1 0x4204752d in vfprintf () from /lib/tls/libc.so.6
#2 0x42069d27 in vasprintf () from /lib/tls/libc.so.6
#3 0x407b4810 in g_strdup_vprintf () from /usr/lib/libglib-2.0.so.0
#4 0x407b4886 in g_strdup_printf () from /usr/lib/libglib-2.0.so.0
#5 0x40588de3 in gdk_pixbuf_new_from_file ()
from /usr/lib/libgdk_pixbuf-2.0.so.0
#6 0x0804ef67 in on_read_ok_button_clicked (button=0x81807b8,
user_data=0x0)
at callbacks.c:267
#7 0x40760d77 in g_cclosure_marshal_VOID__VOID ()
from /usr/lib/libgobject-2.0.so.0
#8 0x4074ded7 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#9 0x40760983 in g_signal_emit_by_name () from
/usr/lib/libgobject-2.0.so.0
#10 0x4075f9a8 in g_signal_emit_valist () from
/usr/lib/libgobject-2.0.so.0
#11 0x4075fbe4 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#12 0x402f1acb in gtk_button_clicked () from /usr/lib/libgtk-x11-2.0.so.0
#13 0x402f2abb in _gtk_button_paint () from /usr/lib/libgtk-x11-2.0.so.0
#14 0x40760d77 in g_cclosure_marshal_VOID__VOID ()
from /usr/lib/libgobject-2.0.so.0
#15 0x4074e247 in g_cclosure_new_swap () from /usr/lib/libgobject-2.0.so.0
#16 0x4074ded7 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#17 0x4076020f in g_signal_emit_by_name () from
/usr/lib/libgobject-2.0.so.0
#18 0x4075f9a8 in g_signal_emit_valist () from
/usr/lib/libgobject-2.0.so.0
#19 0x4075fbe4 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#20 0x402f1a0b in gtk_button_released () from /usr/lib/libgtk-x11-2.0.so.0
#21 0x402f293b in _gtk_button_paint () from /usr/lib/libgtk-x11-2.0.so.0
#22 0x4037cc2f in _gtk_marshal_BOOLEAN__BOXED ()
from /usr/lib/libgtk-x11-2.0.so.0
#23 0x4074e247 in g_cclosure_new_swap () from /usr/lib/libgobject-2.0.so.0
#24 0x4074ded7 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#25 0x40760439 in g_signal_emit_by_name () from
/usr/lib/libgobject-2.0.so.0
#26 0x4075f7af in g_signal_emit_valist () from
/usr/lib/libgobject-2.0.so.0
#27 0x4075fbe4 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#28 0x404626fb in gtk_widget_send_expose () from
/usr/lib/libgtk-x11-2.0.so.0
#29 0x4037ca27 in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0
#30 0x4037b725 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#31 0x4053a1a5 in _gdk_events_queue () from /usr/lib/libgdk-x11-2.0.so.0
#32 0x407a1b35 in g_get_current_time () from /usr/lib/libglib-2.0.so.0
#33 0x407a2b78 in g_main_context_dispatch () from
/usr/lib/libglib-2.0.so.0
#34 0x407a2e8d in g_main_context_dispatch () from
/usr/lib/libglib-2.0.so.0
#35 0x407a358f in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#36 0x4037af5f in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#37 0x0804d425 in main (argc=1, argv=0xbfffef14) at main.c:43
#38 0x42015574 in __libc_start_main () from /lib/tls/libc.so.6
=== end debugger output ===
So, what this gdb output indicates to me is that at the time of the
segmentation fault the file names are valid strings, with a non-zero
string length.
Thanks again for the help so far.
Bryan
*---------------------------------------------------------------
* Bryan Brown <*> bbrown radix net
* http://www.radix.net/~bbrown
*---------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]