/pidgin/main: 738096bade99: gtkblist: Avoid calling the 'select ...

dx <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: 738096bade995d4c38940b5bca9404003948911d
Author:	 dx <[email protected]>
Date:	 2016-05-14 17:55 -0300
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/738096bade99

Description:

gtkblist: Avoid calling the 'select notebook page' timeout after destroy

This showed up as a use-after-free in valgrind, when quitting

diffstat:

 ChangeLog         |   1 +
 pidgin/gtkblist.c |  12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diffs (54 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ version 2.10.13 (MM/DD/YY):
 	* Fixed #14962
 	* Fixed alignment of incoming right-to-left messages in protocols that
 	don't support rich text
+	* Fix a potential crash while exiting pidgin
 
 	Windows-Specific Changes:
 	* Use getaddrinfo for DNS to enable IPv6 (#1075)
diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -119,6 +119,8 @@ typedef struct
 	PidginMiniDialog *signed_on_elsewhere;
 
 	PidginBlistTheme *current_theme;
+
+	guint select_page_timeout;       /**< The timeout for pidgin_blist_select_notebook_page_cb */
 } PidginBuddyListPrivate;
 
 #define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \
@@ -4875,6 +4877,8 @@ static gboolean pidgin_blist_select_note
 
 	priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
 
+	priv->select_page_timeout = 0;
+
 	/* this is far too ugly thanks to me not wanting to fix #3989 properly right now */
 	if (priv->error_scrollbook != NULL) {
 		errors = gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->error_scrollbook->notebook));
@@ -4890,7 +4894,11 @@ static gboolean pidgin_blist_select_note
 
 static void pidgin_blist_select_notebook_page(PidginBuddyList *gtkblist)
 {
-	purple_timeout_add(0, pidgin_blist_select_notebook_page_cb, gtkblist);
+	PidginBuddyListPrivate *priv;
+
+	priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
+
+	priv->select_page_timeout = purple_timeout_add(0, pidgin_blist_select_notebook_page_cb, gtkblist);
 }
 
 static void account_modified(PurpleAccount *account, PidginBuddyList *gtkblist)
@@ -6902,6 +6910,8 @@ static void pidgin_blist_destroy(PurpleB
 	priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
 	if (priv->current_theme)
 		g_object_unref(priv->current_theme);
+	if (priv->select_page_timeout)
+		purple_timeout_remove(priv->select_page_timeout);
 	g_free(priv);
 
 	g_free(gtkblist);

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.