Re: Abend in gdk_pixbuf_new_from_file



El jue, 26 de 02 de 2004 a las 19:02, Bryan Brown escribiÃ:
On 26 Feb 2004, Iago Rubio wrote:

   filename_local = g_strdup(filename);

Thanks for the suggestion.  Here's the code with the as-suggested
modifications.

=== begin code snippet ===

void
on_read_ok_button_clicked (GtkButton  *button,
                           gpointer    user_data)
{
   GdkPixbuf *pixbuf = NULL;
   gchar *filename_local;
   GError *error;
   gchar *filename_local;

There's a little error here. Two gchar* filename_local vars.


   filename = (gchar *) gtk_file_selection_get_filename (
      GTK_FILE_SELECTION (file_selector));
   filename_local = g_strdup (filename);
   gtk_widget_destroy (file_selector);
   pixbuf = gdk_pixbuf_new_from_file (filename_local,
                                      &error);

[snip]

=== end code snippet ===

[snip]

=== begin gdb output ===

Breakpoint 1 at 0x804eef8: file callbacks.c, line 229.
[New Thread 1086104992 (LWP 11212)]
[Switching to Thread 1086104992 (LWP 11212)]

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
#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  0x0804ef3b in on_read_ok_button_clicked (button=0x81807b8,
user_data=0x0)
    at callbacks.c:259

=== end gdb output ==

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

-- 
Iago Rubio                http://www.iagorubio.com          
GPGkey pgp.rediris.es id 0x909BD4DD  fingerprint =
D18A B950 5F03 BB9A DD89  AA75 FEDF 1978 909B D4DD
********** iago.rubio(AT)hispalinux.es  **********     
--------------------------------------------------

Attachment: signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente



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