Abend in gdk_pixbuf_new_from_file
- From: Bryan Brown <bbrown saltmine radix net>
- To: gtk-app-devel-list gnome org
- Subject: Abend in gdk_pixbuf_new_from_file
- Date: Thu, 26 Feb 2004 08:15:50 -0500 (EST)
Hello,
My application (built using gtk 2.x under Redhat 9) sets up a file
selection dialog, waits for the user to select a file, then tries to read
the specified file into a pixbuf.
It's abending with a segmentation fault when it calls
gdk_pixbuf_new_from_file, the user having selected a standard
png-formatted picture file.
Here's a snippet of the relevant code:
===== begin code snip =====
GtkWidget *file_selector;
gchar *filename;
[snip]
void
on_read_ok_button_clicked (GtkButton *button,
gpointer user_data)
{
gchar filename_local[BUFLEN] = "\0";
GError *error;
GdkPixbuf *pixbuf = NULL;
[snip]
filename = (gchar *) gtk_file_selection_get_filename (
GTK_FILE_SELECTION (file_selector));
[snip length checking]
strcpy (filename_local, filename);
gtk_widget_destroy (file_selector);
pixbuf = gdk_pixbuf_new_from_file (filename_local,
&error);
[snip]
void mytest ()
{
[snip]
file_selector = gtk_file_selection_new ("Select an input file");
g_signal_connect (
GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
"clicked",
G_CALLBACK (on_read_ok_button_clicked),
NULL);
g_signal_connect_swapped (
GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
"clicked",
G_CALLBACK (gtk_widget_destroy),
(gpointer) file_selector);
g_signal_connect_swapped (
GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->cancel_button),
"clicked",
G_CALLBACK (gtk_widget_destroy),
(gpointer) file_selector);
gtk_widget_show (file_selector);
}
===== end code snip =====
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]