[Commits] news.c 1.101.2.75 1.101.2.76

colin at claws-mail.org colin at claws-mail.org
Fri Dec 7 10:36:07 CET 2012


Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv6506/src

Modified Files:
      Tag: gtk2
	news.c 
Log Message:
2012-12-07 [colin]	3.9.0cvs44

	* src/news.c
		Try to fix strange crash in nntp_ping/session_destroy...

Index: news.c
===================================================================
RCS file: /home/claws-mail/claws/src/news.c,v
retrieving revision 1.101.2.75
retrieving revision 1.101.2.76
diff -u -d -r1.101.2.75 -r1.101.2.76
--- news.c	28 Nov 2012 11:11:40 -0000	1.101.2.75
+++ news.c	7 Dec 2012 09:36:05 -0000	1.101.2.76
@@ -292,6 +292,8 @@
 	if (session->state != SESSION_READY || news_folder_locked(news_session->folder))
 		return FALSE;
 	
+	news_folder_lock(NEWS_FOLDER(news_session->folder));
+
 	if ((r = nntp_threaded_date(news_session->folder, &lt)) != NEWSNNTP_NO_ERROR) {
 		if (r != NEWSNNTP_ERROR_COMMAND_NOT_SUPPORTED &&
 		    r != NEWSNNTP_ERROR_COMMAND_NOT_UNDERSTOOD) {
@@ -301,10 +303,15 @@
 			    news_session->folder->account->set_nntpport ?
 			    news_session->folder->account->nntpport : NNTP_PORT);
 			REMOTE_FOLDER(news_session->folder)->session = NULL;
+			news_folder_unlock(NEWS_FOLDER(news_session->folder));
+			session->state = SESSION_DISCONNECTED;
+			session->sock = NULL;
 			session_destroy(session);
 			return FALSE;
 		}
 	}
+
+	news_folder_unlock(NEWS_FOLDER(news_session->folder));
 	session_set_access_time(session);
 	return TRUE;
 }
@@ -351,7 +358,6 @@
 
 	session->folder = folder;
 
-	session_register_ping(SESSION(session), nntp_ping);
 	return SESSION(session);
 }
 
@@ -482,6 +488,7 @@
 
 	if (!rfolder->session) {
 		rfolder->session = news_session_new_for_folder(folder);
+		session_register_ping(SESSION(rfolder->session), nntp_ping);
 		return NEWS_SESSION(rfolder->session);
 	}
 
@@ -490,6 +497,7 @@
 	if (rfolder->session->port != folder->account->nntpport) {
 		session_destroy(rfolder->session);
 		rfolder->session = news_session_new_for_folder(folder);
+		session_register_ping(SESSION(rfolder->session), nntp_ping);
 		goto newsession;
 	}
 	
@@ -498,8 +506,10 @@
 		return NEWS_SESSION(rfolder->session);
 	}
 
-	if (!nntp_ping(rfolder->session))
+	if (!nntp_ping(rfolder->session)) {
 		rfolder->session = news_session_new_for_folder(folder);
+		session_register_ping(SESSION(rfolder->session), nntp_ping);
+	}
 
 newsession:
 	if (rfolder->session)



More information about the Commits mailing list