SF.net SVN: geany:[2885] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Aug 13 18:42:13 UTC 2008


Revision: 2885
          http://geany.svn.sourceforge.net/geany/?rev=2885&view=rev
Author:   eht16
Date:     2008-08-13 18:42:11 +0000 (Wed, 13 Aug 2008)

Log Message:
-----------
Fix logging of messages in the debug window on Windows.
When '--debug' option is given on Windows, set the G_SPAWN_WIN32_DEBUG flag for more debug info for spawned processes.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/log.c
    trunk/src/win32.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-08-13 18:40:34 UTC (rev 2884)
+++ trunk/ChangeLog	2008-08-13 18:42:11 UTC (rev 2885)
@@ -8,6 +8,10 @@
    use 'make GTK280=1'.
  * src/support.c:
    Replace fprintf() with g_critical().
+ * src/log.c, src/win32.c:
+   Fix logging of messages in the debug window on Windows.
+   When '--debug' option is given on Windows, set the
+   G_SPAWN_WIN32_DEBUG flag for more debug info for spawned processes.
 
 
 2008-08-13  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/log.c
===================================================================
--- trunk/src/log.c	2008-08-13 18:40:34 UTC (rev 2884)
+++ trunk/src/log.c	2008-08-13 18:42:11 UTC (rev 2885)
@@ -97,8 +97,19 @@
 #ifndef GEANY_DEBUG
 	if (app != NULL && app->debug_mode)
 #endif
-	{	/* print the message as usual on stdout/stderr */
+	{
+#ifdef G_OS_WIN32
+		/* On Windows g_log_default_handler() is not enough, we need to print it
+		 * explicitly on stderr for the console window */
+		/** TODO this can be removed if/when we remove the console window on Windows */
+		if (domain != NULL)
+			fprintf(stderr, "%s: %s\n", domain, msg);
+		else
+			fprintf(stderr, "%s\n", msg);
+#else
+		/* print the message as usual on stdout/stderr */
 		g_log_default_handler(domain, level, msg, data);
+#endif
 	}
 
 	time_str = utils_get_current_time_string();

Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c	2008-08-13 18:40:34 UTC (rev 2884)
+++ trunk/src/win32.c	2008-08-13 18:42:11 UTC (rev 2885)
@@ -703,27 +703,15 @@
 }
 
 
-static void debug_log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message,
-					   gpointer user_data)
-{
-	if (log_domain != NULL)
-		fprintf(stderr, "%s: %s\n", log_domain, message);
-	else
-		fprintf(stderr, "%s\n", message);
-}
-
-
 void win32_init_debug_code()
 {
-#ifndef GEANY_DEBUG
 	if (app->debug_mode)
-#endif
-	{	/* create a console window to get log messages on Windows */
+	{
+		/* create a console window to get log messages on Windows */
+		/** TODO remove me? */
 		debug_setup_console();
-		/* change the log handlers to output log messages in ther created console window */
-		g_log_set_handler("GLib",
-			G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, debug_log_handler, NULL);
-		g_log_set_default_handler(debug_log_handler, NULL);
+		/* Enable GLib process spawn debug mode when Geany was started with the debug flag */
+		g_setenv("G_SPAWN_WIN32_DEBUG", "1", FALSE);
 	}
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list