pidgin: 5bd75cb6: Remove some timeout/input handlers for u..

sadrul at pidgin.im sadrul at pidgin.im
Mon Jul 12 11:12:58 EDT 2010


----------------------------------------------------------------------
Revision: 5bd75cb6ae49344ece9ab07201c5af0bf2c9930c
Parent:   278c9cea4265f5e7877b2eaa47e5b44c049cf7f7
Author:   sadrul at pidgin.im
Date:     07/12/10 10:54:40
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5bd75cb6ae49344ece9ab07201c5af0bf2c9930c

Changelog: 

Remove some timeout/input handlers for upnp.

I made this change a few months back, and I believe it helped someone fix
a crash. Unfortunately I don't remember all the details. But the changes
still look good.

Changes against parent 278c9cea4265f5e7877b2eaa47e5b44c049cf7f7

  patched  libpurple/upnp.c

-------------- next part --------------
============================================================
--- libpurple/upnp.c	9fc379d322544d76786aa42e6e51e8abd4a10a56
+++ libpurple/upnp.c	28515515d7fd74e1d6da94ef74aa49dbb5417ccb
@@ -403,6 +403,11 @@ upnp_parse_description_cb(PurpleUtilFetc
 		lookup_internal_ip();
 	}
 
+	if (dd->inpa > 0)
+		purple_input_remove(dd->inpa);
+	if (dd->tima > 0)
+		purple_timeout_remove(dd->tima);
+
 	g_free(dd);
 }
 
@@ -506,6 +511,8 @@ purple_upnp_discover_timeout(gpointer da
 
 	if (dd->inpa)
 		purple_input_remove(dd->inpa);
+	if (dd->tima > 0)
+		purple_timeout_remove(dd->tima);
 	dd->inpa = 0;
 	dd->tima = 0;
 
@@ -610,7 +617,7 @@ purple_upnp_discover_send_broadcast(UPnP
 
 	/* We have already done all our retries. Make sure that the callback
 	 * doesn't get called before the original function returns */
-	purple_timeout_add(10, purple_upnp_discover_timeout, dd);
+	dd->tima = purple_timeout_add(10, purple_upnp_discover_timeout, dd);
 }
 
 void
@@ -647,7 +654,7 @@ purple_upnp_discover(PurpleUPnPCallback 
 			"purple_upnp_discover(): Failed In sock creation\n");
 		/* Short circuit the retry attempts */
 		dd->retry_count = NUM_UDP_ATTEMPTS;
-		purple_timeout_add(10, purple_upnp_discover_timeout, dd);
+		dd->tima = purple_timeout_add(10, purple_upnp_discover_timeout, dd);
 		return;
 	}
 
@@ -659,7 +666,7 @@ purple_upnp_discover(PurpleUPnPCallback 
 			"purple_upnp_discover(): Failed In gethostbyname\n");
 		/* Short circuit the retry attempts */
 		dd->retry_count = NUM_UDP_ATTEMPTS;
-		purple_timeout_add(10, purple_upnp_discover_timeout, dd);
+		dd->tima = purple_timeout_add(10, purple_upnp_discover_timeout, dd);
 		return;
 	}
 


More information about the Commits mailing list