[Xfce4-commits] <xfdesktop:master> Set warnings as fatal

Eric Koegel noreply at xfce.org
Mon Oct 14 09:00:01 CEST 2013


Updating branch refs/heads/master
         to 1c44c0f12eb2a87e94b217a6251e93255dda34a1 (commit)
       from 38f0d1dc2b3f8bd2739ff773c395c1b81e73d5ee (commit)

commit 1c44c0f12eb2a87e94b217a6251e93255dda34a1
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Mon Oct 14 09:55:28 2013 +0300

    Set warnings as fatal
    
    Fix a couple warning conditions. Also while G_ENABLE_DEBUG is
    defined then set all warning messages as fatal to help catch
    more bugs earlier on in development.

 common/xfdesktop-thumbnailer.c    |   12 ++++++++----
 settings/main.c                   |    6 ++++++
 src/main.c                        |    8 +++++++-
 src/xfdesktop-file-icon-manager.c |    8 +++++++-
 4 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/common/xfdesktop-thumbnailer.c b/common/xfdesktop-thumbnailer.c
index 1cb93f9..2416d8b 100644
--- a/common/xfdesktop-thumbnailer.c
+++ b/common/xfdesktop-thumbnailer.c
@@ -328,8 +328,10 @@ xfdesktop_thumbnailer_queue_thumbnail(XfdesktopThumbnailer *thumbnailer,
                                  G_TYPE_UINT, thumbnailer->priv->handle,
                                  G_TYPE_INVALID) == FALSE)
             {
-                g_warning("Dequeue of thumbnailer->priv->handle: %d failed",
-                          thumbnailer->priv->handle);
+                /* If this fails it usually means there's a thumbnail already
+                 * being processed, no big deal */
+                DBG("Dequeue of thumbnailer->priv->handle: %d failed",
+                    thumbnailer->priv->handle);
             }
 
             thumbnailer->priv->handle = 0;
@@ -381,8 +383,10 @@ xfdesktop_thumbnailer_dequeue_thumbnail(XfdesktopThumbnailer *thumbnailer,
                                  G_TYPE_UINT, thumbnailer->priv->handle,
                                  G_TYPE_INVALID) == FALSE)
             {
-                g_warning("Dequeue of thumbnailer->priv->handle: %d failed",
-                          thumbnailer->priv->handle);
+                /* If this fails it usually means there's a thumbnail already
+                 * being processed, no big deal */
+                DBG("Dequeue of thumbnailer->priv->handle: %d failed",
+                    thumbnailer->priv->handle);
             }
         }
         thumbnailer->priv->handle = 0;
diff --git a/settings/main.c b/settings/main.c
index e132506..69a5da5 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -1569,6 +1569,12 @@ main(int argc, char **argv)
     GtkBuilder *gxml;
     GError *error = NULL;
 
+#ifdef G_ENABLE_DEBUG
+    /* do NOT remove this line. If something doesn't work,
+     * fix your code instead! */
+    g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
+#endif
+
     xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
 
 #if !GLIB_CHECK_VERSION(2, 32, 0)
diff --git a/src/main.c b/src/main.c
index d0f24bc..7669b4f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -248,7 +248,13 @@ main(int argc, char **argv)
         { "quit", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_quit, N_("Cause xfdesktop to quit"), NULL },
         { NULL, 0, 0, 0, NULL, NULL, NULL }
     };
-    
+
+#ifdef G_ENABLE_DEBUG
+    /* do NOT remove this line. If something doesn't work,
+     * fix your code instead! */
+    g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
+#endif
+
     /* bind gettext textdomain */
     xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
 
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index db24d6d..e3625f8 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -2515,7 +2515,13 @@ xfdesktop_file_icon_manager_metadata_changed(GFileMonitor     *monitor,
                                              GFileMonitorEvent event,
                                              gpointer          user_data)
 {
-    XfdesktopFileIconManager *fmanager = XFDESKTOP_FILE_ICON_MANAGER(user_data);
+    XfdesktopFileIconManager *fmanager;
+
+    /* Sanity check */
+    if(user_data == NULL || !XFDESKTOP_IS_FILE_ICON_MANAGER(user_data))
+        return;
+
+    fmanager = XFDESKTOP_FILE_ICON_MANAGER(user_data);
 
     switch(event) {
         case G_FILE_MONITOR_EVENT_CHANGED:


More information about the Xfce4-commits mailing list