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



commit 96f41b62836810563c4f69ba6d053e91c638728a
Author: Mures Andone <mures andone movial com>
Date:   Tue Nov 10 14:59:31 2009 +0200

    Fixed bug 91 (GIO monitoring not working due to bad assert)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=593856

 gio/inotify/ginotifydirectorymonitor.c |   10 ++++++++--
 gio/inotify/ginotifyfilemonitor.c      |   10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/gio/inotify/ginotifydirectorymonitor.c b/gio/inotify/ginotifydirectorymonitor.c
index dd6a28a..f6fcde7 100644
--- a/gio/inotify/ginotifydirectorymonitor.c
+++ b/gio/inotify/ginotifydirectorymonitor.c
@@ -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;
 
diff --git a/gio/inotify/ginotifyfilemonitor.c b/gio/inotify/ginotifyfilemonitor.c
index 0dff7f3..8e572ca 100644
--- a/gio/inotify/ginotifyfilemonitor.c
+++ b/gio/inotify/ginotifyfilemonitor.c
@@ -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;
 



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