[balsa] compose window: Chack BalsaSendmsg:ident



commit b99fd873a077854366c225b633ae38b6fafcc65d
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed May 20 20:49:09 2020 -0400

    compose window: Chack BalsaSendmsg:ident
    
    BalsaSendmsg:ident may be destroyed while the compose window
    is open, and the only way we can know is if it is removed from
    BalsaApplication:indenties.
    
    * src/sendmsg-window.c (balsa_sendmsg_destroy_handler): check if
      BalsaSendmsg:ident can be found in BalsaApplication:indenties.

 ChangeLog            |  9 +++++++++
 src/sendmsg-window.c | 16 +++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a2c9c44fb..d78b54663 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-05-20  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       compose window: BalsaSendmsg:ident may be destroyed while the
+       compose window is open, and the only way we can know is if it
+       is removed from BalsaApplication:indenties
+
+       * src/sendmsg-window.c (balsa_sendmsg_destroy_handler): check if
+       BalsaSendmsg:ident can be found in BalsaApplication:indenties.
+
 2020-05-14  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Bump required versions as discussed in
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 6d760e19b..172e6ea6f 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -618,11 +618,17 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
     g_object_unref(bsmsg->buffer2);
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
-    /* Move the current identity to the start of the list */
-    balsa_app.identities = g_list_remove(balsa_app.identities,
-                                         bsmsg->ident);
-    balsa_app.identities = g_list_prepend(balsa_app.identities,
-                                          bsmsg->ident);
+    if (g_list_find(balsa_app.identities, bsmsg->ident)) {
+        /* Move the current identity to the start of the list */
+        balsa_app.identities =
+            g_list_remove(balsa_app.identities, bsmsg->ident);
+        balsa_app.identities =
+            g_list_prepend(balsa_app.identities, bsmsg->ident);
+    } else {
+        /* The identity was removed from balsa_app.identities, and
+         * probably destroyed, so we'll just drop the pointer. */
+        bsmsg->ident = NULL;
+    }
 
     g_free(bsmsg->spell_check_lang);
     bsmsg->spell_check_lang = NULL;


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