Clear callback handles when returning G_SOURCE_REMOVE

Mon, 31 Oct 2022 03:06:44 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Mon, 31 Oct 2022 03:06:44 -0500
changeset 41866
dadd84e44a30
parent 41865
41e66d907bc9
child 41867
5375c1d58c50

Clear callback handles when returning G_SOURCE_REMOVE

Otherwise, the handle may be used later and cause criticals (most likely when disconnecting / at shutdown).

Testing Done:
Added XMPP account which was disconnected by the server, and no longer saw a critical about not finding a source ID. Sametime was not tested.

Reviewed at https://reviews.imfreedom.org/r/2002/

libpurple/protocols/jabber/jabber.c file | annotate | diff | comparison | revisions
libpurple/protocols/sametime/sametime.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/jabber/jabber.c	Sun Oct 30 03:31:24 2022 -0500
+++ b/libpurple/protocols/jabber/jabber.c	Mon Oct 31 03:06:44 2022 -0500
@@ -606,6 +606,7 @@
 			purple_connection_error(js->gc,
 			                        PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			                        _("Server closed the connection"));
+			js->inpa = 0;
 			return G_SOURCE_REMOVE;
 		} else if (len < 0) {
 			if (error->code == G_IO_ERROR_WOULD_BLOCK) {
@@ -618,6 +619,7 @@
 				               _("Lost connection with server: "));
 				purple_connection_take_error(js->gc, error);
 			}
+			js->inpa = 0;
 			return G_SOURCE_REMOVE;
 		}
 
--- a/libpurple/protocols/sametime/sametime.c	Sun Oct 30 03:31:24 2022 -0500
+++ b/libpurple/protocols/sametime/sametime.c	Mon Oct 31 03:06:44 2022 -0500
@@ -1651,6 +1651,7 @@
       purple_connection_error(pd->gc,
                               PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
                               _("Server closed the connection"));
+	  pd->inpa = 0;
       return G_SOURCE_REMOVE;
     } else if (len < 0) {
       /* read problem occurred if we're here, so we'll need to take care of

mercurial