Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Fixed bug 91 (GIO monitoring not working due to bad assert)
Browse files Browse the repository at this point in the history
  • Loading branch information
muresandone authored and alexlarsson committed Nov 26, 2009
1 parent fbde782 commit c5b846e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions gio/inotify/ginotifydirectorymonitor.c
Expand Up @@ -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));
Expand All @@ -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;

Expand Down
10 changes: 8 additions & 2 deletions gio/inotify/ginotifyfilemonitor.c
Expand Up @@ -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));
Expand All @@ -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;

Expand Down

0 comments on commit c5b846e

Please sign in to comment.