diff options
author | Pacho Ramos <pacho@gentoo.org> | 2013-04-21 11:39:50 +0000 |
---|---|---|
committer | Pacho Ramos <pacho@gentoo.org> | 2013-04-21 11:39:50 +0000 |
commit | a9fb6ac97e8ebd29155bb757564e672fe5f1d1f5 (patch) | |
tree | dee5a31ca737af37790d783568dd1d10797cbe09 /net-voip/telepathy-haze | |
parent | Remove the version from dev-tex/tex4ht (diff) | |
download | historical-a9fb6ac97e8ebd29155bb757564e672fe5f1d1f5.tar.gz historical-a9fb6ac97e8ebd29155bb757564e672fe5f1d1f5.tar.bz2 historical-a9fb6ac97e8ebd29155bb757564e672fe5f1d1f5.zip |
Version bump, bug #466256 by Andreas Mielke
Package-Manager: portage-2.1.11.62/cvs/Linux x86_64
Manifest-Sign-Key: 0xA188FBD4
Diffstat (limited to 'net-voip/telepathy-haze')
-rw-r--r-- | net-voip/telepathy-haze/ChangeLog | 10 | ||||
-rw-r--r-- | net-voip/telepathy-haze/Manifest | 13 | ||||
-rw-r--r-- | net-voip/telepathy-haze/files/001-handle_purple_account_request_password.patch | 269 | ||||
-rw-r--r-- | net-voip/telepathy-haze/files/002-fix_resource_leakage.patch | 141 | ||||
-rw-r--r-- | net-voip/telepathy-haze/files/003-fix_more_resource_leaks.patch | 213 | ||||
-rw-r--r-- | net-voip/telepathy-haze/telepathy-haze-0.7.0.ebuild | 38 |
6 files changed, 679 insertions, 5 deletions
diff --git a/net-voip/telepathy-haze/ChangeLog b/net-voip/telepathy-haze/ChangeLog index e6c8764713aa..45150588e8e3 100644 --- a/net-voip/telepathy-haze/ChangeLog +++ b/net-voip/telepathy-haze/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-voip/telepathy-haze # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-voip/telepathy-haze/ChangeLog,v 1.38 2013/03/30 17:10:44 eva Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-voip/telepathy-haze/ChangeLog,v 1.39 2013/04/21 11:39:40 pacho Exp $ + +*telepathy-haze-0.7.0 (21 Apr 2013) + + 21 Apr 2013; Pacho Ramos <pacho@gentoo.org> + +files/001-handle_purple_account_request_password.patch, + +files/002-fix_resource_leakage.patch, + +files/003-fix_more_resource_leaks.patch, +telepathy-haze-0.7.0.ebuild: + Version bump, bug #466256 by Andreas Mielke 30 Mar 2013; Gilles Dartiguelongue <eva@gentoo.org> -telepathy-haze-0.5.0.ebuild: diff --git a/net-voip/telepathy-haze/Manifest b/net-voip/telepathy-haze/Manifest index 7a48131f187f..dcb139e1aa74 100644 --- a/net-voip/telepathy-haze/Manifest +++ b/net-voip/telepathy-haze/Manifest @@ -1,14 +1,19 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 +AUX 001-handle_purple_account_request_password.patch 8398 SHA256 e35c1525593b3c6cb66f197c39c2b8a332c01b86eb33b5ec34557e48194282ee SHA512 53569c79a0125bd6338003a41312a80ff41d7164d22d2218a83bccbed7b5b9c493cf1647060dce3932241b221dda6894926128a9e8baa633bb975346e5724648 WHIRLPOOL a836f7d37e8c970099fd10699e19c21c5bbc7834ae19538b4a828da64181792d4322c8d47650ca1dcd9160229a0b1c5e67dcd763a49b9fabb226d373c03c6d76 +AUX 002-fix_resource_leakage.patch 4526 SHA256 2597e4bae0e23090de4d7edc7c13495adf266aa8a774be9aa034679682b414ac SHA512 65890c988d860f8ce862a277b93a51fa0f6738f4dc44f466c661503f11c6fd4ea74e9136364ffa1b06538c560671b44c6223b39fec02e7f8cbf680d7b6de5909 WHIRLPOOL 8342d4bb2a155b5327b2aa2138c664ee1ad5426417ffd83a54e0ee2da322ae90c12fad1d49032e924fd866e3dc70aaef62bf360fddb288e0833a1d7a39a834c9 +AUX 003-fix_more_resource_leaks.patch 6663 SHA256 7423812e904da7600f25120ec4a428c917800cf7fa92f0c1aceb158f90c8bb9f SHA512 271533ecf415f4880675f68fa14c9057acefa95339b0e2cd2dfd10f39414a81f9dd1622b56ad8669b91f7f8f59ace3d9ba73499f66e4e937888d9b2a59e6d994 WHIRLPOOL 27a6cbe1adfbcc73eeaf02e0f9940425a34d8100a6deeaae0e642afcd930cc2ebda83a601e550f7ec3f218f0514dbe3061c825ddb392f6da8b65e46fe1f5eba2 DIST telepathy-haze-0.6.0.tar.gz 558413 SHA256 e267c54aef8f85746899e365ae344fe9ec73c1aec04298bedad6a88732ab2fe3 SHA512 db87f7f1be4217ab464d3a3fdb33c6121931c286a102b6af7e3a06ece21b88606c41f3eabc1ad2453e58f5091f6a141dbf2369c7d277b135aebf9b0f37cbe2f0 WHIRLPOOL a8f29ee0aee83cddb386d55bbdbe7df2d77acfc936c1ce0e5786345c3e7a20d3d608e4df99b8e5ebc2fcd5644d7ecfa9641564561f9f538fc325259b0f31a52d +DIST telepathy-haze-0.7.0.tar.gz 559037 SHA256 0b0143358af2435ec267cf62bd1c475e4d6e1f8e950e87bf7da3d288424152bd SHA512 9749ca9733f20b47da84412d35d7cc28d305fcfc8085450456914a6d7907de7cfb4de5e8f7c8e1b06e412feeed5dbc272c69ce889bedc0ac8598aae96beaf677 WHIRLPOOL e432ea9327ee2aa3b3a6a58b73eb916f9f4b45fee5518ce128dd03d705c82b9f3bc90ffd48e541170a28f688fc15f0675d44ce93f2f9e59b4aa37352e6fbc41b EBUILD telepathy-haze-0.6.0.ebuild 983 SHA256 7d94ee2fe751c588615f518c3b621dad9a68e77b37043a41c52a68416dc14ffb SHA512 ba7c4b890c029b2c8af0c94c27f138f6d1dd02028f0b3694586c4359f9af440cef8428483f4c72d0f9c4e525ee7e44613c38199ef292a14576d5770106334c23 WHIRLPOOL 3ef77de410fbc465c40469b775bf46e0c8f87018d2a8bcbcaa19d29b82f57e7d46373459bb13616e44ebf5cede296c514162b9c5af30c12c5611084851707248 -MISC ChangeLog 5248 SHA256 2d2fa357c7a8f7e2e2cdbe3037e64711cfae411e28d3e9f167058809beacf8bd SHA512 667b461d99366d7f2af7a685e7b330a86156cdf76b64d556d1739d7399902a771a189d8ddd42b8a8dcfe3cd3e9c554becfc1ca21ace94c8f5c0fd097d6a0e391 WHIRLPOOL 068b2dcabda4a9c3b40151f4b4cc4a48e7e54fc740dbb5476571823f3e1818e304398834439360f40c1b5134083a858130ae8cf44f5cc69767d20cc47b98334c +EBUILD telepathy-haze-0.7.0.ebuild 1151 SHA256 84152c71d6c2f7593f966bcd08c275438738e0cc3b16a509a0391d4b25e1a4cb SHA512 f124d0066704b913588ac78fa45dcce549954275e59e8587a9bddcb814666d8906f20b9d0a8d8fc7ace40247a1b7fa15f4d0e9291b72dac88f6f0b327047fc57 WHIRLPOOL cbd2bb175ece0d4a051b19818fe3247040819ac459288fba6fbaa584a814069659665a00ade81ae0b0a4f7a8d17f4cb142230c245afadb1a1bd97a0cff11b9c9 +MISC ChangeLog 5554 SHA256 a8eaf02e8c30cb1f436bb9e9f388069d336908eefbb2fdd9ffc522314888f5c8 SHA512 45583d7fbd4df886b2304e8a1dfa77bdb8db8b50f24f49a01df465f5aec3eab5db318c6c028ec4fa01fe2888fbeb07f94c4448e0a8b33138ccb800b7ce9c0498 WHIRLPOOL a37be96bd6ab45f02db4140a1fe1a057ed202b4f2df741ff6163d87da0ec2f81904e4add6b4bc79f497adce9409d09f7aab90288bef8751863680ebab8cc01e0 MISC metadata.xml 322 SHA256 0658eb62f074a6ca6adf1c572753ae025b4c1e9048d3d4c0529f98cf2cb6bfa3 SHA512 b0d4a71235e1d7b0c53baae758153e624c4d324389700bbdb4ea8983f0a7f808727ea9821f88efd9058bb739a7c6e3c07cc24fbc496156fabb300b3e7312bea6 WHIRLPOOL 0ec9fb4d4e13f14f744a25ee5a025dd430b08a2ea85413fa02b616b853e602ffec00c24bafd5c0c65cef876b741956b4f11fe8f1681164a2bff3f95b44dc66b0 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) -iEYEAREIAAYFAlFXHJUACgkQ1fmVwcYIWAZijgCglA6p160avsa4233/y7ybazQ3 -o7MAn18sSQkRTBAn9eYt4mpu95Bk9Hq/ -=SRMY +iEYEAREIAAYFAlFzz/0ACgkQCaWpQKGI+9T1NACdF54oJ3tIhQKiVr8UgFEAuMFS +I60AnRMdxRURKhK+aPnCrI+R9cDo+JJ6 +=DiHC -----END PGP SIGNATURE----- diff --git a/net-voip/telepathy-haze/files/001-handle_purple_account_request_password.patch b/net-voip/telepathy-haze/files/001-handle_purple_account_request_password.patch new file mode 100644 index 000000000000..e53b378c0a31 --- /dev/null +++ b/net-voip/telepathy-haze/files/001-handle_purple_account_request_password.patch @@ -0,0 +1,269 @@ +From 66b7fff2f65b65a5d298bf868bb8e21a32492a58 Mon Sep 17 00:00:00 2001 +From: Stefan Becker <chemobejk@gmail.com> +Date: Tue, 09 Apr 2013 16:30:34 +0000 +Subject: request: handle purple_account_request_password() + +This is needed for libpurple plugins with optional password, e.g. SIPE +since 1.14.1. That libpurple API call boils down to a +purple_request_fields() call. + +The flagging for --enable-leaky-request-stubs was refactored so that +this new code is always compiled in. + +https://bugs.freedesktop.org/show_bug.cgi?id=63326 +--- +diff --git a/src/connection.c b/src/connection.c +index 0b272a9..6e9121d 100644 +--- a/src/connection.c ++++ b/src/connection.c +@@ -42,6 +42,7 @@ + #include "connection-avatars.h" + #include "connection-mail.h" + #include "extensions/extensions.h" ++#include "request.h" + + #include "connection-capabilities.h" + +@@ -138,6 +139,9 @@ struct _HazeConnectionPrivate + gchar *prpl_id; + PurplePluginProtocolInfo *prpl_info; + ++ /* Set if purple_account_request_password() was called */ ++ gpointer password_request; ++ + /* Set if purple_account_disconnect has been called or is scheduled to be + * called, so should not be called again. + */ +@@ -446,6 +450,11 @@ _haze_connection_password_manager_prompt_cb (GObject *source, + { + DEBUG ("Simple password manager failed: %s", error->message); + ++ if (priv->password_request) ++ { ++ haze_request_password_cb(priv->password_request, NULL); ++ } ++ + if (base_conn->status != TP_CONNECTION_STATUS_DISCONNECTED) + { + tp_base_connection_disconnect_with_dbus_error (base_conn, +@@ -454,7 +463,13 @@ _haze_connection_password_manager_prompt_cb (GObject *source, + } + + /* no need to call purple_account_disconnect because _connect +- * was never called */ ++ * was never called ... ++ * ... unless we had a dynamic password request */ ++ if (priv->password_request) ++ { ++ priv->disconnecting = TRUE; ++ purple_account_disconnect (self->account); ++ } + + g_error_free (error); + return; +@@ -463,11 +478,17 @@ _haze_connection_password_manager_prompt_cb (GObject *source, + g_free (priv->password); + priv->password = g_strdup (password->str); + +- purple_account_set_password (self->account, priv->password); ++ if (priv->password_request) ++ { ++ haze_request_password_cb (priv->password_request, priv->password); ++ } else ++ { ++ purple_account_set_password (self->account, priv->password); + +- purple_account_set_enabled(self->account, UI_ID, TRUE); +- purple_account_connect (self->account); +- priv->connect_called = TRUE; ++ purple_account_set_enabled(self->account, UI_ID, TRUE); ++ purple_account_connect (self->account); ++ priv->connect_called = TRUE; ++ } + } + + static gboolean +@@ -516,6 +537,20 @@ _haze_connection_start_connecting (TpBaseConnection *base, + return TRUE; + } + ++void haze_connection_request_password (PurpleAccount *account, ++ void *user_data) ++{ ++ HazeConnection *self = ACCOUNT_GET_HAZE_CONNECTION (account); ++ HazeConnectionPrivate *priv = self->priv; ++ ++ priv->password_request = user_data; ++ ++ /* pop up auth channel */ ++ tp_simple_password_manager_prompt_async (self->password_manager, ++ _haze_connection_password_manager_prompt_cb, ++ self); ++} ++ + static void + _haze_connection_shut_down (TpBaseConnection *base) + { +diff --git a/src/connection.h b/src/connection.h +index c69a7c1..2e68935 100644 +--- a/src/connection.h ++++ b/src/connection.h +@@ -111,6 +111,9 @@ const gchar *haze_get_fallback_group (void); + const gchar **haze_connection_get_implemented_interfaces (void); + const gchar **haze_connection_get_guaranteed_interfaces (void); + ++void haze_connection_request_password (PurpleAccount *account, ++ gpointer user_data); ++ + G_END_DECLS + + #endif /* #ifndef __HAZE_CONNECTION_H__*/ +diff --git a/src/main.c b/src/main.c +index afa0a02..4cd171c 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -141,9 +141,7 @@ haze_ui_init (void) + purple_accounts_set_ui_ops (haze_get_account_ui_ops ()); + purple_conversations_set_ui_ops (haze_get_conv_ui_ops ()); + purple_connections_set_ui_ops (haze_get_connection_ui_ops ()); +-#ifdef ENABLE_LEAKY_REQUEST_STUBS + purple_request_set_ui_ops (haze_request_get_ui_ops ()); +-#endif + purple_notify_set_ui_ops (haze_notify_get_ui_ops ()); + purple_privacy_set_ui_ops (haze_get_privacy_ui_ops ()); + } +diff --git a/src/request.c b/src/request.c +index 408678b..dae859d 100644 +--- a/src/request.c ++++ b/src/request.c +@@ -18,6 +18,8 @@ + * + */ + ++#include "config.h" ++ + #include <glib-object.h> + + #include <libpurple/account.h> +@@ -25,7 +27,9 @@ + + #include "debug.h" + #include "request.h" ++#include "connection.h" + ++#ifdef ENABLE_LEAKY_REQUEST_STUBS + static gpointer + haze_request_input (const char *title, + const char *primary, +@@ -95,6 +99,30 @@ haze_request_action (const char *title, + + return NULL; + } ++#endif ++ ++struct password_data { ++ PurpleRequestFields *fields; ++ PurpleRequestField *password; ++ GCallback ok_cb; ++ GCallback cancel_cb; ++ void *user_data; ++}; ++ ++void haze_request_password_cb (gpointer user_data, ++ const gchar *password) ++{ ++ struct password_data *pd = user_data; ++ ++ if (password) { ++ purple_request_field_string_set_value(pd->password, password); ++ ((PurpleRequestFieldsCb)pd->ok_cb)(pd->user_data, pd->fields); ++ } else { ++ ((PurpleRequestFieldsCb)pd->cancel_cb)(pd->user_data, pd->fields); ++ } ++ ++ g_free(pd); ++} + + static gpointer + haze_request_fields (const char *title, +@@ -110,14 +138,36 @@ haze_request_fields (const char *title, + PurpleConversation *conv, + void *user_data) + { +- DEBUG ("ignoring request:"); +- DEBUG (" title: %s", (title ? title : "(null)")); +- DEBUG (" primary: %s", (primary ? primary : "(null)")); +- DEBUG (" secondary: %s", (secondary ? secondary : "(null)")); ++ /* ++ * We must support purple_account_request_password() which boils down ++ * to purple_request_fields() with certain parameters. I'm not sure ++ * if this the best way of doing this, but it works. ++ */ ++ if (purple_request_fields_exists(fields, "password") && ++ purple_request_fields_exists(fields, "remember")) { ++ struct password_data *pd = g_new0(struct password_data, 1); ++ ++ DEBUG ("triggering password request"); ++ ++ pd->fields = fields; ++ pd->password = purple_request_fields_get_field(fields, "password"); ++ pd->ok_cb = ok_cb; ++ pd->cancel_cb = cancel_cb; ++ pd->user_data = user_data; ++ ++ haze_connection_request_password(account, pd); ++ ++ } else { ++ DEBUG ("ignoring request:"); ++ DEBUG (" title: %s", (title ? title : "(null)")); ++ DEBUG (" primary: %s", (primary ? primary : "(null)")); ++ DEBUG (" secondary: %s", (secondary ? secondary : "(null)")); ++ } + + return NULL; + } + ++#ifdef ENABLE_LEAKY_REQUEST_STUBS + static gpointer + haze_request_file (const char *title, + const char *filename, +@@ -152,7 +202,7 @@ haze_request_folder (const char *title, + + return NULL; + } +- ++#endif + + /* + void (*close_request)(PurpleRequestType type, void *ui_handle); +@@ -160,12 +210,14 @@ haze_request_folder (const char *title, + + static PurpleRequestUiOps request_uiops = + { ++#ifdef ENABLE_LEAKY_REQUEST_STUBS + .request_input = haze_request_input, + .request_choice = haze_request_choice, + .request_action = haze_request_action, +- .request_fields = haze_request_fields, + .request_file = haze_request_file, +- .request_folder = haze_request_folder ++ .request_folder = haze_request_folder, ++#endif ++ .request_fields = haze_request_fields + }; + + PurpleRequestUiOps * +diff --git a/src/request.h b/src/request.h +index d896cc6..cc572d6 100644 +--- a/src/request.h ++++ b/src/request.h +@@ -20,4 +20,7 @@ + + #include <libpurple/request.h> + ++void haze_request_password_cb (gpointer user_data, ++ const gchar *password); ++ + PurpleRequestUiOps *haze_request_get_ui_ops (void); +-- +cgit v0.9.0.2-2-gbebe diff --git a/net-voip/telepathy-haze/files/002-fix_resource_leakage.patch b/net-voip/telepathy-haze/files/002-fix_resource_leakage.patch new file mode 100644 index 000000000000..ebf15dd6dc4c --- /dev/null +++ b/net-voip/telepathy-haze/files/002-fix_resource_leakage.patch @@ -0,0 +1,141 @@ +From eef971c3aeb61b9b60013f3b728f62e7ac5580bf Mon Sep 17 00:00:00 2001 +From: Stefan Becker <chemobejk@gmail.com> +Date: Wed, 10 Apr 2013 13:13:04 +0000 +Subject: request: fix resource leakage + +It is the responsibility of the UI code to free the "fields" parameter +after haze_request_fields() has been called. This has to be done with +purple_request_close() and handled in the close_request() UI operation. + +https://bugs.freedesktop.org/show_bug.cgi?id=63326 +--- +diff --git a/src/request.c b/src/request.c +index dae859d..db54317 100644 +--- a/src/request.c ++++ b/src/request.c +@@ -101,7 +101,7 @@ haze_request_action (const char *title, + } + #endif + +-struct password_data { ++struct fields_data { + PurpleRequestFields *fields; + PurpleRequestField *password; + GCallback ok_cb; +@@ -109,21 +109,40 @@ struct password_data { + void *user_data; + }; + ++static void haze_close_request(PurpleRequestType type, void *ui_handle) ++{ ++ struct fields_data *fd = ui_handle; ++ ++ purple_request_fields_destroy(fd->fields); ++ g_free(fd); ++} ++ + void haze_request_password_cb (gpointer user_data, + const gchar *password) + { +- struct password_data *pd = user_data; ++ struct fields_data *fd = user_data; + + if (password) { +- purple_request_field_string_set_value(pd->password, password); +- ((PurpleRequestFieldsCb)pd->ok_cb)(pd->user_data, pd->fields); ++ purple_request_field_string_set_value(fd->password, password); ++ ((PurpleRequestFieldsCb)fd->ok_cb)(fd->user_data, fd->fields); + } else { +- ((PurpleRequestFieldsCb)pd->cancel_cb)(pd->user_data, pd->fields); ++ ((PurpleRequestFieldsCb)fd->cancel_cb)(fd->user_data, fd->fields); + } + +- g_free(pd); ++ purple_request_close(PURPLE_REQUEST_FIELDS, fd); + } + ++static gboolean haze_request_fields_destroy(gpointer user_data) ++{ ++ purple_request_close(PURPLE_REQUEST_FIELDS, user_data); ++ return FALSE; ++} ++ ++/* ++ * We must support purple_account_request_password() which boils down ++ * to purple_request_fields() with certain parameters. I'm not sure ++ * if this the best way of doing this, but it works. ++ */ + static gpointer + haze_request_fields (const char *title, + const char *primary, +@@ -138,33 +157,34 @@ haze_request_fields (const char *title, + PurpleConversation *conv, + void *user_data) + { +- /* +- * We must support purple_account_request_password() which boils down +- * to purple_request_fields() with certain parameters. I'm not sure +- * if this the best way of doing this, but it works. +- */ ++ struct fields_data *fd = g_new0(struct fields_data, 1); ++ ++ /* it is our responsibility to destroy this data */ ++ fd->fields = fields; ++ + if (purple_request_fields_exists(fields, "password") && + purple_request_fields_exists(fields, "remember")) { +- struct password_data *pd = g_new0(struct password_data, 1); + + DEBUG ("triggering password request"); + +- pd->fields = fields; +- pd->password = purple_request_fields_get_field(fields, "password"); +- pd->ok_cb = ok_cb; +- pd->cancel_cb = cancel_cb; +- pd->user_data = user_data; ++ fd->password = purple_request_fields_get_field(fields, "password"); ++ fd->ok_cb = ok_cb; ++ fd->cancel_cb = cancel_cb; ++ fd->user_data = user_data; + +- haze_connection_request_password(account, pd); ++ haze_connection_request_password(account, fd); + + } else { + DEBUG ("ignoring request:"); + DEBUG (" title: %s", (title ? title : "(null)")); + DEBUG (" primary: %s", (primary ? primary : "(null)")); + DEBUG (" secondary: %s", (secondary ? secondary : "(null)")); ++ ++ /* Avoid leaking of "fields" */ ++ g_idle_add(haze_request_fields_destroy, fd); + } + +- return NULL; ++ return fd; + } + + #ifdef ENABLE_LEAKY_REQUEST_STUBS +@@ -204,10 +224,6 @@ haze_request_folder (const char *title, + } + #endif + +-/* +- void (*close_request)(PurpleRequestType type, void *ui_handle); +-*/ +- + static PurpleRequestUiOps request_uiops = + { + #ifdef ENABLE_LEAKY_REQUEST_STUBS +@@ -217,7 +233,8 @@ static PurpleRequestUiOps request_uiops = + .request_file = haze_request_file, + .request_folder = haze_request_folder, + #endif +- .request_fields = haze_request_fields ++ .request_fields = haze_request_fields, ++ .close_request = haze_close_request + }; + + PurpleRequestUiOps * +-- +cgit v0.9.0.2-2-gbebe diff --git a/net-voip/telepathy-haze/files/003-fix_more_resource_leaks.patch b/net-voip/telepathy-haze/files/003-fix_more_resource_leaks.patch new file mode 100644 index 000000000000..380af23b2955 --- /dev/null +++ b/net-voip/telepathy-haze/files/003-fix_more_resource_leaks.patch @@ -0,0 +1,213 @@ +From 4068d8504b2155168b82144a4d45b138e0579ef2 Mon Sep 17 00:00:00 2001 +From: Stefan Becker <chemobejk@gmail.com> +Date: Thu, 11 Apr 2013 12:45:34 +0000 +Subject: request: fix more resource leaks + +Triggered by Will's review comments. + +- check callback pointers to be non-NULL before calling them +- call cancel_cb also in destroy idle callback +- reset connection's password request field on closing +- coding style cleanup + +https://bugs.freedesktop.org/show_bug.cgi?id=63326 +--- +diff --git a/src/connection.c b/src/connection.c +index 6e9121d..424802e 100644 +--- a/src/connection.c ++++ b/src/connection.c +@@ -452,7 +452,7 @@ _haze_connection_password_manager_prompt_cb (GObject *source, + + if (priv->password_request) + { +- haze_request_password_cb(priv->password_request, NULL); ++ haze_request_password_cb (priv->password_request, NULL); + } + + if (base_conn->status != TP_CONNECTION_STATUS_DISCONNECTED) +@@ -481,7 +481,8 @@ _haze_connection_password_manager_prompt_cb (GObject *source, + if (priv->password_request) + { + haze_request_password_cb (priv->password_request, priv->password); +- } else ++ } ++ else + { + purple_account_set_password (self->account, priv->password); + +@@ -537,8 +538,9 @@ _haze_connection_start_connecting (TpBaseConnection *base, + return TRUE; + } + +-void haze_connection_request_password (PurpleAccount *account, +- void *user_data) ++void ++haze_connection_request_password (PurpleAccount *account, ++ void *user_data) + { + HazeConnection *self = ACCOUNT_GET_HAZE_CONNECTION (account); + HazeConnectionPrivate *priv = self->priv; +@@ -551,6 +553,15 @@ void haze_connection_request_password (PurpleAccount *account, + self); + } + ++void ++haze_connection_cancel_password_request (PurpleAccount *account) ++{ ++ HazeConnection *self = ACCOUNT_GET_HAZE_CONNECTION (account); ++ HazeConnectionPrivate *priv = self->priv; ++ ++ priv->password_request = NULL; ++} ++ + static void + _haze_connection_shut_down (TpBaseConnection *base) + { +diff --git a/src/connection.h b/src/connection.h +index 2e68935..7fc8668 100644 +--- a/src/connection.h ++++ b/src/connection.h +@@ -113,6 +113,7 @@ const gchar **haze_connection_get_guaranteed_interfaces (void); + + void haze_connection_request_password (PurpleAccount *account, + gpointer user_data); ++void haze_connection_cancel_password_request (PurpleAccount *account); + + G_END_DECLS + +diff --git a/src/request.c b/src/request.c +index db54317..8aa7bc9 100644 +--- a/src/request.c ++++ b/src/request.c +@@ -102,39 +102,62 @@ haze_request_action (const char *title, + #endif + + struct fields_data { ++ PurpleAccount *account; + PurpleRequestFields *fields; + PurpleRequestField *password; +- GCallback ok_cb; +- GCallback cancel_cb; ++ PurpleRequestFieldsCb ok_cb; ++ PurpleRequestFieldsCb cancel_cb; + void *user_data; + }; + +-static void haze_close_request(PurpleRequestType type, void *ui_handle) ++static void ++haze_close_request (PurpleRequestType type, ++ void *ui_handle) + { + struct fields_data *fd = ui_handle; + +- purple_request_fields_destroy(fd->fields); +- g_free(fd); ++ haze_connection_cancel_password_request (fd->account); ++ purple_request_fields_destroy (fd->fields); ++ g_slice_free (struct fields_data, fd); + } + +-void haze_request_password_cb (gpointer user_data, +- const gchar *password) ++void ++haze_request_password_cb (gpointer user_data, ++ const gchar *password) + { + struct fields_data *fd = user_data; + +- if (password) { +- purple_request_field_string_set_value(fd->password, password); +- ((PurpleRequestFieldsCb)fd->ok_cb)(fd->user_data, fd->fields); +- } else { +- ((PurpleRequestFieldsCb)fd->cancel_cb)(fd->user_data, fd->fields); +- } +- +- purple_request_close(PURPLE_REQUEST_FIELDS, fd); ++ if (password) ++ { ++ purple_request_field_string_set_value (fd->password, password); ++ if (fd->ok_cb) ++ { ++ (fd->ok_cb) (fd->user_data, fd->fields); ++ } ++ } ++ else ++ { ++ if (fd->cancel_cb) ++ { ++ (fd->cancel_cb) (fd->user_data, fd->fields); ++ } ++ } ++ ++ purple_request_close (PURPLE_REQUEST_FIELDS, fd); + } + +-static gboolean haze_request_fields_destroy(gpointer user_data) ++static gboolean ++haze_request_fields_destroy (gpointer user_data) + { +- purple_request_close(PURPLE_REQUEST_FIELDS, user_data); ++ struct fields_data *fd = user_data; ++ ++ if (fd->cancel_cb) ++ { ++ (fd->cancel_cb) (fd->user_data, fd->fields); ++ } ++ ++ purple_request_close (PURPLE_REQUEST_FIELDS, user_data); ++ + return FALSE; + } + +@@ -157,32 +180,36 @@ haze_request_fields (const char *title, + PurpleConversation *conv, + void *user_data) + { +- struct fields_data *fd = g_new0(struct fields_data, 1); ++ struct fields_data *fd = g_slice_new0 (struct fields_data); + + /* it is our responsibility to destroy this data */ +- fd->fields = fields; ++ fd->account = account; ++ fd->fields = fields; ++ fd->cancel_cb = (PurpleRequestFieldsCb) cancel_cb; ++ fd->user_data = user_data; + +- if (purple_request_fields_exists(fields, "password") && +- purple_request_fields_exists(fields, "remember")) { ++ if (purple_request_fields_exists (fields, "password") && ++ purple_request_fields_exists (fields, "remember")) ++ { + + DEBUG ("triggering password request"); + +- fd->password = purple_request_fields_get_field(fields, "password"); +- fd->ok_cb = ok_cb; +- fd->cancel_cb = cancel_cb; +- fd->user_data = user_data; ++ fd->password = purple_request_fields_get_field (fields, "password"); ++ fd->ok_cb = (PurpleRequestFieldsCb) ok_cb; + +- haze_connection_request_password(account, fd); ++ haze_connection_request_password (account, fd); + +- } else { ++ } ++ else ++ { + DEBUG ("ignoring request:"); + DEBUG (" title: %s", (title ? title : "(null)")); + DEBUG (" primary: %s", (primary ? primary : "(null)")); + DEBUG (" secondary: %s", (secondary ? secondary : "(null)")); + +- /* Avoid leaking of "fields" */ +- g_idle_add(haze_request_fields_destroy, fd); +- } ++ /* Avoid leaking of "fields" and "user_data" */ ++ g_idle_add (haze_request_fields_destroy, fd); ++ } + + return fd; + } +-- +cgit v0.9.0.2-2-gbebe diff --git a/net-voip/telepathy-haze/telepathy-haze-0.7.0.ebuild b/net-voip/telepathy-haze/telepathy-haze-0.7.0.ebuild new file mode 100644 index 000000000000..49a7274d2095 --- /dev/null +++ b/net-voip/telepathy-haze/telepathy-haze-0.7.0.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-voip/telepathy-haze/telepathy-haze-0.7.0.ebuild,v 1.1 2013/04/21 11:39:40 pacho Exp $ + +EAPI=5 +PYTHON_COMPAT=( python2_{5,6,7} ) + +inherit eutils python-single-r1 + +DESCRIPTION="Telepathy connection manager providing libpurple supported protocols." +HOMEPAGE="http://developer.pidgin.im/wiki/TelepathyHaze" +SRC_URI="http://telepathy.freedesktop.org/releases/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86" +#IUSE="test" +IUSE="" + +# Tests failing, see upstream: https://bugs.freedesktop.org/34577 +RESTRICT="test" + +RDEPEND=" + >=net-im/pidgin-2.7 + >=net-libs/telepathy-glib-0.15.1[${PYTHON_USEDEP}] + >=dev-libs/glib-2.22:2 + >=dev-libs/dbus-glib-0.73 +" +DEPEND="${RDEPEND} + virtual/pkgconfig" +# test? ( dev-python/twisted-words )" + +src_prepare() { + # Apply some upstream fixes + epatch "${FILESDIR}"/001-handle_purple_account_request_password.patch + epatch "${FILESDIR}"/002-fix_resource_leakage.patch + epatch "${FILESDIR}"/003-fix_more_resource_leaks.patch +} |