almanah r101 - in trunk: . src



Author: pwithnall
Date: Thu Nov 13 18:10:29 2008
New Revision: 101
URL: http://svn.gnome.org/viewvc/almanah?rev=101&view=rev

Log:
2008-11-13  Philip Withnall  <philip tecnocode co uk>

	* src/interface.c (almanah_calendar_month_changed_cb):
	* src/main-window.c (mw_entry_buffer_cursor_position_cb):
	* src/storage-manager.c (almanah_storage_manager_query),
	(almanah_storage_manager_free_results),
	(almanah_storage_manager_get_statistics),
	(almanah_storage_manager_get_month_marked_days): Changed from 
GSlice
	allocation to the more-appropriate g_malloc and g_new.
	May fix some slice-related crashes on quitting.



Modified:
   trunk/ChangeLog
   trunk/src/interface.c
   trunk/src/main-window.c
   trunk/src/storage-manager.c

Modified: trunk/src/interface.c
==============================================================================
--- trunk/src/interface.c	(original)
+++ trunk/src/interface.c	Thu Nov 13 18:10:29 2008
@@ -84,5 +84,5 @@
 			gtk_calendar_unmark_day (calendar, i);
 	}
 
-	g_slice_free (gboolean, days);
+	g_free (days);
 }

Modified: trunk/src/main-window.c
==============================================================================
--- trunk/src/main-window.c	(original)
+++ trunk/src/main-window.c	Thu Nov 13 18:10:29 2008
@@ -541,7 +541,7 @@
 			gtk_toggle_action_set_active (action, TRUE);
 		} else {
 			/* Print a warning about the unknown tag */
-			g_message (_("Unknown or duplicate text tag \"%s\" in entry. Ignoring."), tag_name);
+			g_warning (_("Unknown or duplicate text tag \"%s\" in entry. Ignoring."), tag_name);
 		}
 
 		g_free (tag_name);

Modified: trunk/src/storage-manager.c
==============================================================================
--- trunk/src/storage-manager.c	(original)
+++ trunk/src/storage-manager.c	Thu Nov 13 18:10:29 2008
@@ -543,7 +543,7 @@
 	new_query = sqlite3_vmprintf (query, params);
 	va_end (params);
 
-	results = g_slice_new (AlmanahQueryResults);
+	results = g_new (AlmanahQueryResults, 1);
 
 	if (almanah->debug)
 		g_debug ("Database query: %s", new_query);
@@ -565,7 +565,7 @@
 almanah_storage_manager_free_results (AlmanahQueryResults *results)
 {
 	sqlite3_free_table (results->data);
-	g_slice_free (AlmanahQueryResults, results);
+	g_free (results);
 }
 
 gboolean
@@ -614,6 +614,7 @@
 		*entry_count = atoi (results->data[1]);
 		if (*entry_count == 0) {
 			*link_count = 0;
+			almanah_storage_manager_free_results (results);
 			return TRUE;
 		}
 	}
@@ -625,7 +626,6 @@
 		return FALSE;
 	} else if (results->rows != 1) {
 		*link_count = 0;
-
 		almanah_storage_manager_free_results (results);
 		return FALSE;
 	} else {
@@ -839,13 +839,13 @@
 	return result_count - 1;
 }
 
-/* NOTE: Free results with g_slice_free */
+/* NOTE: Free results with g_free */
 gboolean *
 almanah_storage_manager_get_month_marked_days (AlmanahStorageManager *self, GDateYear year, GDateMonth month)
 {
 	AlmanahQueryResults *results;
 	guint i;
-	gboolean *days = g_slice_alloc0 (sizeof (gboolean) * 32);
+	gboolean *days = g_malloc0 (sizeof (gboolean) * 32);
 
 	results = almanah_storage_manager_query (self, "SELECT day FROM entries WHERE year = %u AND month = %u", NULL,
 						 year,



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