2011-02-13 [colin] 3.7.8cvs55
authorColin Leroy <colin@colino.net>
Sun, 13 Feb 2011 21:59:10 +0000 (21:59 +0000)
committerColin Leroy <colin@colino.net>
Sun, 13 Feb 2011 21:59:10 +0000 (21:59 +0000)
* src/mimeview.c
* src/mimeview.h
Fix bug #2361, "Claws crashes after PGP Check in separate
msg view". Don't let the cancel thread lie around after
the verification ended.

ChangeLog
PATCHSETS
configure.ac
src/mimeview.c
src/mimeview.h

index 557acc4..e12703f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-02-13 [colin]     3.7.8cvs55
+
+       * src/mimeview.c
+       * src/mimeview.h
+               Fix bug #2361, "Claws crashes after PGP Check in separate
+               msg view". Don't let the cancel thread lie around after
+               the verification ended.
+
 2011-02-13 [paul]      3.7.8cvs54
 
        * po/lt.po
index 4b69d83..f33d761 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.27 -r 1.1.2.28 src/ldapupdate.c;  ) > 3.7.8cvs52.patchset
 ( cvs diff -u -r 1.1.2.17 -r 1.1.2.18 manual/es/advanced.xml;  cvs diff -u -r 1.179.2.252 -r 1.179.2.253 src/imap.c;  ) > 3.7.8cvs53.patchset
 ( cvs diff -u -r 1.1.2.1 -r 1.1.2.2 po/lt.po;  ) > 3.7.8cvs54.patchset
+( cvs diff -u -r 1.83.2.165 -r 1.83.2.166 src/mimeview.c;  cvs diff -u -r 1.20.2.29 -r 1.20.2.30 src/mimeview.h;  ) > 3.7.8cvs55.patchset
index 984066c..7b1222d 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=54
+EXTRA_VERSION=55
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index c3e5f0c..ab7b551 100644 (file)
@@ -530,7 +530,6 @@ void mimeview_destroy(MimeView *mimeview)
        g_slist_free(mimeview->viewers);
        gtk_target_list_unref(mimeview->target_list);
 
-       mimeview_free_mimeinfo(mimeview);
 #ifdef USE_PTHREAD
        if (mimeview->check_data) {
                mimeview->check_data->destroy_mimeview = TRUE;
@@ -538,6 +537,7 @@ void mimeview_destroy(MimeView *mimeview)
        } else 
 #endif
        {
+               mimeview_free_mimeinfo(mimeview);
                g_free(mimeview->file);
                g_free(mimeview);
                mimeviews = g_slist_remove(mimeviews, mimeview);
@@ -938,22 +938,36 @@ static void update_signature_noticeview(MimeView *mimeview, MimeInfo *mimeinfo,
 /* reset all thread stuff, and do the cleanups we've been left to do */
 static void mimeview_check_data_reset(MimeView *mimeview)
 {
+       gboolean must_free;
+       gboolean must_destroy;
+
        if (!mimeview->check_data)
                return;
 
-       if (mimeview->check_data->free_after_use) {
+       must_free = mimeview->check_data->free_after_use;
+       must_destroy = mimeview->check_data->destroy_mimeview;
+       
+       if (mimeview->check_data->cancel_th) {
+               debug_print("killing canceller thread\n");
+               pthread_cancel(mimeview->check_data->cancel_th);
+               mimeview->check_data->cancel_th = 0;
+       }
+
+       g_free(mimeview->check_data);
+       mimeview->check_data = NULL;
+
+       if (must_free) {
                debug_print("freeing deferred mimeinfo\n");
                procmime_mimeinfo_free_all(mimeview->check_data->siginfo);
        }
-       if (mimeview->check_data->destroy_mimeview) {
+       if (must_destroy) {
                debug_print("freeing deferred mimeview\n");
+               mimeview_free_mimeinfo(mimeview);
                g_free(mimeview->file);
                g_free(mimeview);
                mimeviews = g_slist_remove(mimeviews, mimeview);
        }
 
-       g_free(mimeview->check_data);
-       mimeview->check_data = NULL;
 }
 
 /* GUI update once the checker thread is done or killed */
@@ -1013,9 +1027,13 @@ static void *mimeview_check_sig_worker_thread(void *data)
        if (!mimeview->check_data)
                return NULL;
 
-       if (mimeinfo && mimeinfo == mimeview->check_data->siginfo)
+       if (mimeinfo && mimeinfo == mimeview->check_data->siginfo) {
                privacy_mimeinfo_check_signature(mimeinfo);
-       else {
+               if (mimeview->check_data->cancel_th) {
+                       pthread_cancel(mimeview->check_data->cancel_th);
+                       mimeview->check_data->cancel_th = 0;
+               }
+       } else {
                /* that's strange! we changed message without 
                 * getting killed. */
                g_warning("different siginfo!\n");
@@ -1111,6 +1129,8 @@ static void mimeview_check_sig_in_thread(MimeView *mimeview)
        pthread_create(&th2, &detach2, 
                        mimeview_check_sig_cancel_thread, 
                        mimeview);
+
+       mimeview->check_data->cancel_th = th2;
 }
 #endif
 
index 163891a..b9d8f8a 100644 (file)
@@ -48,6 +48,7 @@ typedef struct _SigCheckData SigCheckData;
 struct _SigCheckData
 {
        pthread_t th;
+       pthread_t cancel_th;
        MimeInfo *siginfo;
        gboolean free_after_use;
        gboolean destroy_mimeview;