more plumbing in Hoa's code (can't wait to have all these settings moved into folderl...
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Mon, 24 Sep 2001 18:41:31 +0000 (18:41 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Mon, 24 Sep 2001 18:41:31 +0000 (18:41 +0000)
ChangeLog.claws
src/prefs_folder_item.c

index 34f273e0a73f715c8cf2f5eabaf4482a39f997c2..1543c1f88907ce7bf54fe2750c8afc16559a68f1 100644 (file)
@@ -1,3 +1,9 @@
+2001-09-24 [alfons]
+       
+       * src/prefs_folder_item.c
+               add check for item->prefs->default_to string is NULL and
+               add another check when freeing this string
+
 2001-09-24 [paul]
 
        * configure.in
index f716c8e8c39384e11006c8cb9ac7aead05d0c6f0..038fca1e504515087a3e89faf03964d62690c58e 100644 (file)
@@ -180,7 +180,8 @@ PrefsFolderItem * prefs_folder_item_new(void)
 
 void prefs_folder_item_free(PrefsFolderItem * prefs)
 {
-       g_free(prefs->default_to);
+       if (prefs->default_to) 
+               g_free(prefs->default_to);
        if (prefs->scoring != NULL)
                prefs_scoring_free(prefs->scoring);
        g_free(prefs);
@@ -215,6 +216,9 @@ gint prefs_folder_item_get_sort_type(FolderItem * item)
                return GTK_SORT_ASCENDING;
 }
 
+#define SAFE_STRING(str) \
+       (str) ? (str) : ""
+
 void prefs_folder_item_create(FolderItem *item) {
        struct PrefsFolderItemDialog *dialog;
        GtkWidget *window;
@@ -266,7 +270,7 @@ void prefs_folder_item_create(FolderItem *item) {
        PACK_CHECK_BUTTON(vbox, checkbtn_request_return_receipt,
                           _("Request Return Receipt"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt),
-                                    item->ret_rcpt);
+                                    item->ret_rcpt ? TRUE : FALSE);
 
        /* Default To */
        hbox = gtk_hbox_new(FALSE, 8);
@@ -283,7 +287,7 @@ void prefs_folder_item_create(FolderItem *item) {
        gtk_widget_show(entry_default_to);
        gtk_box_pack_start(GTK_BOX(hbox), entry_default_to, FALSE, FALSE, 0);
        gtk_editable_set_editable(GTK_EDITABLE(entry_default_to), item->prefs->enable_default_to);
-       gtk_entry_set_text(GTK_ENTRY(entry_default_to), item->prefs->default_to);
+       gtk_entry_set_text(GTK_ENTRY(entry_default_to), SAFE_STRING(item->prefs->default_to));
 
        /* Folder chmod */
        hbox = gtk_hbox_new(FALSE, 8);