SF.net SVN: geany:[3878] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Jun 20 16:52:30 UTC 2009


Revision: 3878
          http://geany.svn.sourceforge.net/geany/?rev=3878&view=rev
Author:   eht16
Date:     2009-06-20 16:52:30 +0000 (Sat, 20 Jun 2009)

Log Message:
-----------
Properly clean up the logging mechanism.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-06-20 16:52:14 UTC (rev 3877)
+++ trunk/ChangeLog	2009-06-20 16:52:30 UTC (rev 3878)
@@ -14,6 +14,8 @@
    "Open with Geany" context menu item.
  * plugins/splitwindow.c:
    Avoid using deprecated GTK API.
+ * src/log.c, src/main.c:
+   Properly clean up the logging mechanism.
 
 
 2009-06-18  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/log.c
===================================================================
--- trunk/src/log.c	2009-06-20 16:52:14 UTC (rev 3877)
+++ trunk/src/log.c	2009-06-20 16:52:30 UTC (rev 3878)
@@ -74,18 +74,22 @@
 static void handler_print(const gchar *msg)
 {
 	printf("%s\n", msg);
-	g_string_append_printf(log_buffer, "%s\n", msg);
-
-	update_dialog();
+	if (G_LIKELY(log_buffer != NULL))
+	{
+		g_string_append_printf(log_buffer, "%s\n", msg);
+		update_dialog();
+	}
 }
 
 
 static void handler_printerr(const gchar *msg)
 {
 	fprintf(stderr, "%s\n", msg);
-	g_string_append_printf(log_buffer, "%s\n", msg);
-
-	update_dialog();
+	if (G_LIKELY(log_buffer != NULL))
+	{
+		g_string_append_printf(log_buffer, "%s\n", msg);
+		update_dialog();
+	}
 }
 
 
@@ -208,5 +212,8 @@
 
 void log_finalize(void)
 {
+	g_log_set_default_handler(g_log_default_handler, NULL);
+
 	g_string_free(log_buffer, TRUE);
+	log_buffer = NULL;
 }

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2009-06-20 16:52:14 UTC (rev 3877)
+++ trunk/src/main.c	2009-06-20 16:52:30 UTC (rev 3878)
@@ -1109,7 +1109,6 @@
 	encodings_finalize();
 	toolbar_finalize();
 	configuration_finalize();
-	/* must be last */
 	log_finalize();
 
 	tm_workspace_free(TM_WORK_OBJECT(app->tm_workspace));


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