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

segfault with no ~/.gtkrc



While working on a gtk program, I discovered that it seg faulted for a new
user I added and did not seg fault for me.  I discovered that the dependency
was whether there was a .gtkrc file in the home dir.  No ~/.gtkrc file, the
program segfaults - otherwise runs fine.  I am not aware that there is 
a requirement that there be a ~/.gtkrc.  If there is, please enlighten
me, otherwise, read on.

Incidentally, when I create a new user and start X with .xsession containing
    exec /usr/bin/gnome-session
the panel does not come up unless there is a ~/.gtkrc file.  I am still
experimenting with this one.

I have reproduced this behavior on two Debian machines, each fully
dist-upgraded to potato as of two days ago.

Anyway, here is the program reduced to isolate the part that
causes the core dump.  Compile with:

gcc -g -Wall `gtk-config --cflags` `imlib-config --cflags-gdk`  \
  `gtk-config --cflags` `imlib-config --cflags-gdk`  gg.c -o gg \
  `gtk-config --libs` `imlib-config --libs-gdk`

/* ---------------- Cut here and write to file gg.c ---------------- */
#include <gtk/gtk.h>
#include <gdk_imlib.h>

GdkPixmap       *pixmap;
GdkPixmap       *mask;

int
main (int argc, char *argv[])
        {
        GtkWidget       *window;
        GtkWidget       *button;
        GtkWidget       *vbox;

        gtk_init (&argc, &argv);

        gdk_imlib_load_file_to_pixmap("penguin.png", &pixmap, &mask);

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_widget_set_name (window, "gism");

        vbox = gtk_vbox_new (FALSE, 0);
        gtk_container_add (GTK_CONTAINER (window), vbox);
        gtk_widget_show (vbox);

        button = gtk_button_new_with_label ("Q");
        gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);

        gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
                        GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window
));
        gtk_widget_show (button);
        gtk_widget_show (window);

        gtk_main ();
        return 0;
        }
/* --------------------------------------------------------------------- */


Transcript for a user with no ~/.gtkrc:

/ram/gism$ ./gg
Segmentation fault (core dumped)
/ram/gism$ gdb gg core
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Core was generated by `./gg'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libgtk-1.2.so.0...done.
Reading symbols from /usr/lib/libgdk-1.2.so.0...done.
Reading symbols from /usr/lib/libgmodule-1.2.so.0...done.
Reading symbols from /usr/lib/libglib-1.2.so.0...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /usr/X11R6/lib/libXi.so.6...done.
Reading symbols from /usr/X11R6/lib/libXext.so.6...done.
Reading symbols from /usr/X11R6/lib/libX11.so.6...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /usr/lib/libgdk_imlib.so.1...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libnss_compat.so.2...done.
Reading symbols from /lib/libnsl.so.1...done.
#0  0x402768ed in gdk_imlib_load_image () from /usr/lib/libgdk_imlib.so.1
(gdb) where
#0  0x402768ed in gdk_imlib_load_image () from /usr/lib/libgdk_imlib.so.1
#1  0x402948cb in gdk_imlib_load_file_to_pixmap ()
   from /usr/lib/libgdk_imlib.so.1
#2  0x8048b3a in main (argc=1, argv=0xbffffb94) at gism.c:16



Note that it is irrelevant whether the "penguin.png" file exists. 
If it does not exist, the program as written still runs if there is
a ~/.gtkrc.

-----------------------------------------------------------------------------
Bill Wilson <billw@wt.net>


Reply to: