Fixed bug 91 (GIO monitoring not working due to bad assert)

https://bugzilla.gnome.org/show_bug.cgi?id=593856
This commit is contained in:
Mures Andone 2009-11-10 14:59:31 +02:00 committed by Alexander Larsson
parent 97db31fa14
commit 96f41b6283
2 changed files with 16 additions and 4 deletions

View File

@ -76,6 +76,7 @@ g_inotify_directory_monitor_constructor (GType type,
GInotifyDirectoryMonitor *inotify_monitor;
const gchar *dirname = NULL;
inotify_sub *sub = NULL;
gboolean ret_ih_startup; /* return value of _ih_startup, for asserting */
klass = G_INOTIFY_DIRECTORY_MONITOR_CLASS (g_type_class_peek (G_TYPE_INOTIFY_DIRECTORY_MONITOR));
parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
@ -90,13 +91,18 @@ g_inotify_directory_monitor_constructor (GType type,
/* Will never fail as is_supported() should be called before instanciating
* anyway */
g_assert (_ih_startup ());
/* assert on return value */
ret_ih_startup = _ih_startup();
g_assert (ret_ih_startup);
sub = _ih_sub_new (dirname, NULL, inotify_monitor);
/* 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));
/* _ih_sub_add allways returns TRUE, see gio/inotify/inotify-helper.c line 109
* g_assert (_ih_sub_add (sub)); */
_ih_sub_add(sub);
inotify_monitor->sub = sub;

View File

@ -90,6 +90,7 @@ g_inotify_file_monitor_constructor (GType type,
GInotifyFileMonitor *inotify_monitor;
const gchar *filename = NULL;
inotify_sub *sub = NULL;
gboolean ret_ih_startup; /* return value of _ih_startup, for asserting */
klass = G_INOTIFY_FILE_MONITOR_CLASS (g_type_class_peek (G_TYPE_INOTIFY_FILE_MONITOR));
parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
@ -108,14 +109,19 @@ g_inotify_file_monitor_constructor (GType type,
/* Will never fail as is_supported() should be called before instanciating
* anyway */
g_assert (_ih_startup ());
/* assert on return value */
ret_ih_startup = _ih_startup();
g_assert (ret_ih_startup);
sub = _ih_sub_new (inotify_monitor->dirname, inotify_monitor->filename, inotify_monitor);
/* 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));
/* _ih_sub_add allways returns TRUE, see gio/inotify/inotify-helper.c line 109
* g_assert (_ih_sub_add (sub)); */
_ih_sub_add (sub);
inotify_monitor->sub = sub;