segfault: g_type_init() missing

Aaron Ecay aaronecay at gmail.com
Sat Jul 23 21:32:39 PDT 2011


Dear all,

I just pulled the last couple weeks' worth of changes and rebuilt
notmuch, only to have the new binary give a segfault on "notmuch new"
(running on OS X.6).  The error message printed was:

(process:21821): GLib-GObject-CRITICAL **: gtype.c:2708: You forgot to
call g_type_init()

And the backtrace (from gdb):

#0  0x000a18f7 in g_object_newv ()
#1  0x000160e4 in notmuch_filter_discard_uuencode_new ()
#2  0x000163f0 in _index_mime_part ()
#3  0x0001667a in _notmuch_message_index_file ()
#4  0x0001247c in notmuch_database_add_message ()
#5  0x000065a9 in add_files_recursive ()
#6  0x0000612c in add_files_recursive ()
#7  0x0000612c in add_files_recursive ()
#8  0x000071ec in notmuch_new_command ()
#9  0x00003a5a in main ()

According to the Glib docs
(http://developer.gnome.org/gobject/unstable/gobject-Type-Information.html#g-type-init),
the g_type_init() function must be called before using any GType
stuff, which notmuch_filter_discard_uuencode_new does.  There are no
grep hits for g_type_init in the notmuch sources, though.  The code on
the error path looks pretty old, so I'm not sure why this bug hasn't
hit someone else before.  Adding a call to g_type_init() to main()
(right after g_mime_init(0)) fixes the problem.

Aaron


More information about the notmuch mailing list