Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv7214/src
Modified Files:
main.c misc_confirm.c prefs.c prefs.h
Log Message:
* src/main.c
src/misc_confirm.c
src/prefs.c
src/prefs.h: avoid assertions when shutting gtkpod down.
Index: main.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/main.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- main.c 7 Apr 2007 14:55:49 -0000 1.61
+++ main.c 9 Apr 2007 11:58:00 -0000 1.62
@@ -121,7 +121,7 @@
gtkpod_window = gtkpod_xml_get_widget (main_window_xml, "gtkpod");
- init_prefs(argc, argv);
+ prefs_init (argc, argv);
init_default_file (argv[0]);
Index: misc_confirm.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/misc_confirm.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- misc_confirm.c 25 Mar 2007 13:18:26 -0000 1.48
+++ misc_confirm.c 9 Apr 2007 11:58:01 -0000 1.49
@@ -1,6 +1,5 @@
-/* Time-stamp: <2007-02-20 23:05:44 jcs>
-|
-| Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
+/*
+| Copyright (C) 2002-2007 Jorg Schuler <jcsjcs at users sourceforge net>
| Part of the gtkpod project.
|
| URL: http://www.gtkpod.org/
@@ -874,7 +873,13 @@
{
server_shutdown (); /* stop accepting requests for playcount updates */
- cleanup_prefs();
+ /* Sort column order needs to be stored */
+ tm_store_col_order();
+
+ /* Update default sizes */
+ display_update_default_sizes();
+
+ prefs_save ();
/* FIXME: release memory in a clean way */
#if 0
@@ -885,6 +890,8 @@
#endif
display_cleanup ();
+ prefs_shutdown ();
+
call_script ("gtkpod.out", NULL);
gtk_main_quit ();
return FALSE;
Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.281
retrieving revision 1.282
diff -u -d -r1.281 -r1.282
--- prefs.c 8 Apr 2007 15:08:30 -0000 1.281
+++ prefs.c 9 Apr 2007 11:58:01 -0000 1.282
@@ -625,8 +625,17 @@
/* Write prefs to file */
static void write_prefs_to_file(FILE *fp)
{
- if (prefs_table)
- g_hash_table_foreach(prefs_table, write_key, (gpointer)fp);
+ lock_prefs_table ();
+
+ if (!prefs_table)
+ {
+ unlock_prefs_table ();
+ g_return_if_reached ();
+ }
+
+ g_hash_table_foreach(prefs_table, write_key, (gpointer)fp);
+
+ unlock_prefs_table ();
}
/* Load preferences, first loading the defaults, and then overwrite that with
@@ -670,7 +679,7 @@
}
/* Save preferences to user home folder (~/gtkpod/prefs) */
-static void save_prefs()
+void prefs_save ()
{
gchar *filename; /* Path of file to write to */
gchar *config_dir; /* Folder where prefs file is */
@@ -1088,18 +1097,8 @@
prefs_set_string ("version", VERSION);
}
-/* Do things that need to be done before saving prefs */
-static void finalize_prefs()
-{
- /* Sort column order needs to be stored */
- tm_store_col_order();
-
- /* Update default sizes */
- display_update_default_sizes();
-}
-
/* Initialize the prefs table and read configuration */
-void init_prefs(int argc, char *argv[])
+void prefs_init (int argc, char *argv[])
{
if (!prefs_table_mutex)
prefs_table_mutex = g_mutex_new ();
@@ -1125,17 +1124,17 @@
read_commandline(argc, argv);
}
-/* Save prefs data to a file, and then delete the hash table */
-void cleanup_prefs()
+/* Delete the hash table */
+void prefs_shutdown ()
{
- /* Let prefs do some things before saving */
- finalize_prefs();
-
- /* Save prefs */
- save_prefs();
-
lock_prefs_table ();
+ if (!prefs_table)
+ {
+ unlock_prefs_table ();
+ g_return_if_reached ();
+ }
+
/* Delete the prefs hash table */
g_hash_table_destroy(prefs_table);
prefs_table = NULL;
@@ -1193,6 +1192,8 @@
{
struct sub_data sub_data;
+ lock_prefs_table ();
+
g_return_val_if_fail (prefs_table, (unlock_prefs_table(), NULL));
sub_data.temp_prefs = temp_prefs_create ();
@@ -1200,6 +1201,8 @@
g_hash_table_foreach (prefs_table, (GHFunc)get_subset, &sub_data);
+ unlock_prefs_table ();
+
return sub_data.temp_prefs;
}
Index: prefs.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.h,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -d -r1.195 -r1.196
--- prefs.h 8 Apr 2007 15:08:31 -0000 1.195
+++ prefs.h 9 Apr 2007 11:58:01 -0000 1.196
@@ -76,8 +76,9 @@
} TempLists;
/* Prefrences setup and cleanup */
-void init_prefs(int argc, char *argv[]);
-void cleanup_prefs();
+void prefs_init (int argc, char *argv[]);
+void prefs_save (void);
+void prefs_shutdown (void);
/*
* Functions that are used to manipulate prefrences.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2