GSlice: g_thread_init() must be called before all other GLib functions;



Hi,

I get the following error message when running my GTK app:

GSlice: g_thread_init() must be called before all other GLib functions;
memory corruption due to late invocation of g_thread_init() has been
detected; this program is likely to crash, leak or unexpectedly abort
soon...


I read here<http://blogs.gnome.org/timj/2007/01/02/28122006-g_slicedebug-blocks/>that
the correct workaround is to call
g_thread_init(NULL).
However, when I try to do that I get an "undefined reference to
g_thread_init" error.

And this happens even if I include glib.h.

I did a grep on the header files I have in /usr/include and got this:
glib-1.2/glib.h:void   g_thread_init   (GThreadFunctions       *vtable);
glib-2.0/glib/gthread.h:void    g_thread_init   (GThreadFunctions
*vtable);
glib-2.0/glib/gthread.h:void    g_thread_init_with_errorcheck_mutexes
(GThreadFunctions* vtable);
glib-2.0/glib/gthread.h:#define g_thread_init(vtable)
g_thread_init_with_errorcheck_mutexes (vtable)
glibmm-2.4/glibmm/thread.h:  g_thread_init(vtable);
grep: warning: lua50/lua: recursive directory loop

So I added the corresponding headers:
#include <glib-2.0/glib/gthread.h>
#include <glib-1.2/glib.h>

But I still get the undefined reference error.

After some printf debugging, I traced the origin of the warning to the
creation of a filechooser button.
And when I create a new GTK project with Anjuta+Glade2 and place a
filechooser button, I do indeed always get this warning.

How can I get rid of this warning the correct way?
Where am I supposed to place the g_thread_init() call?



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