Re: segfault on gtk_init



Hi,

Have you tried linking against gthread-2.0 instead of gthread?

IEK

ginko wrote:
This program written for multiple threads experiences a segfault very early
on; the stripped down code is as follows (the segfault occurs on
gtk_init()):

#include <pthread.h>
#include <glib.h>
#include <gtk/gtk.h>

int main(int argc, char* argv[])
{
   if (!g_thread_supported())
   {
      g_thread_init(NULL);
      gdk_threads_init();
      //printf("Entered.\n");
   }

   gtk_init(&argc, &argv);

   return 0;
}

The segfault is confusing, since the program's barely done anything yet.
Running with GDB outputs this:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1088074176 (LWP 15889)]
0x40381d14 in pthread_mutex_lock () from /lib/tls/libpthread.so.0

Compiled with Eclipse's CDT plugin using the following:

g++
-I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include
-I/usr/include/cairo -I/usr/include/freetype2 -I/usr/X11R6/include
-I/usr/include/libpng12 -I/opt/gnome/include/atk-1.0
-I/opt/gnome/include/pango-1.0 -I/opt/gnome/include/glib-2.0
-I/opt/gnome/lib/glib-2.0/include -O0 -g3 -Wall -c -fmessage-length=0

-lavcodec -lgthread -lpthread -lavformat -lgtk-x11-2.0 -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf.2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lfreetype -lfontconfig
-lXrender -lX11 -lXext -lpng12 -lz -lglitz -lm

-L/usr/local/lib -L/usr/X11R6/lib -L/opt/gnome/lib


Thanks for any input.
--
View this message in context: http://www.nabble.com/segfault-on-gtk_init-t1452085.html#a3924153
Sent from the Gtk+ - General forum at Nabble.com.

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list






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