GNOME Bugzilla – Bug 593856
file and directory monitors don't work when glib is compiled with --enable-debug=no
Last modified: 2009-11-26 14:43:45 UTC
Created attachment 142281 [details] [review] 0001-Allow-code-in-g_assert-to-have-side-effects.patch The inotify file and directory monitors use g_asset with side-effects. See the functions g_inotify_directory_monitor_constructor and g_inotify_file_monitor_constructor: /* FIXME: what to do about errors here? we can't return NULL or another * kind of error and an assertion is probably too hard */ g_assert (sub != NULL); g_assert (_ih_sub_add (sub)); <========= When the debug is disabled the function _ih_sub_add is not called. There are two possible solutions for this issue: fix the inotify monitor code or allow the g_assert to have side-effects (see the attached patch).
I prefer to fix the inotify monitor code.
Created attachment 147469 [details] [review] Fix g_assert() usage Would this patch do? It was originally attached to http://linux.onarm.com/bugzilla/show_bug.cgi?id=91 hence the suboptimal commit message...
I'd suggest to either make _ih_sub_add() return void, or handle the return value even if it's currently always TRUE. That's better than keeping the gboolean return while relying on it always being TRUE.
commited to master and glib-2-22