/pidgin/main: 2e4dd08b0131: Conversations: fix glib warnings

Tomasz Wasilczyk twasilczyk at pidgin.im
Thu Jun 12 13:04:01 EDT 2014


Changeset: 2e4dd08b0131a8249a051aed9640fd291de2ef24
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-06-12 19:03 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/2e4dd08b0131

Description:

Conversations: fix glib warnings

diffstat:

 libpurple/conversation.c      |  10 +++++++++-
 libpurple/conversationtypes.c |   6 +-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diffs (64 lines):

diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -414,7 +414,8 @@ purple_conversation_set_title(PurpleConv
 	g_free(priv->title);
 	priv->title = g_strdup(title);
 
-	g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_TITLE]);
+	if (!g_object_get_data(G_OBJECT(conv), "is-finalizing"))
+		g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_TITLE]);
 
 	purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_TITLE);
 }
@@ -1133,6 +1134,12 @@ purple_conversation_constructed(GObject 
 	g_object_unref(account);
 }
 
+static void
+purple_conversation_dispose(GObject *object)
+{
+	g_object_set_data(object, "is-finalizing", GINT_TO_POINTER(TRUE));
+}
+
 /* GObject finalize function */
 static void
 purple_conversation_finalize(GObject *object)
@@ -1175,6 +1182,7 @@ purple_conversation_class_init(PurpleCon
 
 	parent_class = g_type_class_peek_parent(klass);
 
+	obj_class->dispose = purple_conversation_dispose;
 	obj_class->finalize = purple_conversation_finalize;
 	obj_class->constructed = purple_conversation_constructed;
 
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -55,8 +55,6 @@ struct _PurpleChatConversationPrivate
 	char *nick;         /* Your nick in this chat.                   */
 	gboolean left;      /* We left the chat and kept the window open */
 	GHashTable *users;  /* Hash table of the users in the room.      */
-
-	gboolean is_finalizing;    /* The object is being destroyed. */
 };
 
 /* Chat Property enums */
@@ -1291,7 +1289,7 @@ purple_chat_conversation_leave(PurpleCha
 
 	priv->left = TRUE;
 
-	if (!priv->is_finalizing)
+	if (!g_object_get_data(G_OBJECT(chat), "is-finalizing"))
 		g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_LEFT]);
 
 	purple_conversation_update(PURPLE_CONVERSATION(chat), PURPLE_CONVERSATION_UPDATE_CHATLEFT);
@@ -1467,8 +1465,6 @@ purple_chat_conversation_finalize(GObjec
 	PurpleConnection *gc = purple_conversation_get_connection(PURPLE_CONVERSATION(chat));
 	PurpleChatConversationPrivate *priv = PURPLE_CHAT_CONVERSATION_GET_PRIVATE(chat);
 
-	priv->is_finalizing = TRUE;
-
 	if (gc != NULL)
 	{
 		/* Still connected */



More information about the Commits mailing list